diff --git a/src/main/java/com/nutomic/syncthingandroid/util/FolderObserver.java b/src/main/java/com/nutomic/syncthingandroid/util/FolderObserver.java index 130bfe8c..6cb65550 100644 --- a/src/main/java/com/nutomic/syncthingandroid/util/FolderObserver.java +++ b/src/main/java/com/nutomic/syncthingandroid/util/FolderObserver.java @@ -22,7 +22,7 @@ public class FolderObserver extends FileObserver { private final String mPath; - private final ArrayList mChilds; + private final ArrayList mChilds = new ArrayList<>(); public interface OnFolderFileChangeListener { public void onFolderFileChange(String folderId, String relativePath); @@ -74,9 +74,10 @@ public class FolderObserver extends FileObserver { } }); - mChilds = new ArrayList<>(); - for (File f : directories) { - mChilds.add(new FolderObserver(mListener, mFolder, path + "/" + f.getName())); + if (directories != null) { + for (File f : directories) { + mChilds.add(new FolderObserver(mListener, mFolder, path + "/" + f.getName())); + } } }