From fbe62a153ffed4dae226d46c68a5ee09d8e38ba6 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 16 Jun 2018 22:34:41 +0200 Subject: catch OOM in FileObserver --- .../java/de/pixart/messenger/utils/ConversationsFileObserver.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/java/de') diff --git a/src/main/java/de/pixart/messenger/utils/ConversationsFileObserver.java b/src/main/java/de/pixart/messenger/utils/ConversationsFileObserver.java index 34110d7fd..72a01a13c 100644 --- a/src/main/java/de/pixart/messenger/utils/ConversationsFileObserver.java +++ b/src/main/java/de/pixart/messenger/utils/ConversationsFileObserver.java @@ -31,7 +31,12 @@ public abstract class ConversationsFileObserver { String parent = stack.pop(); mObservers.add(new SingleFileObserver(parent, FileObserver.DELETE | FileObserver.MOVED_FROM)); final File path = new File(parent); - final File[] files = path.listFiles(); + File[] files = new File[0]; + try { + files = path.listFiles(); + } catch (OutOfMemoryError e) { + e.printStackTrace(); + } if (files == null) { continue; } -- cgit v1.2.3