From 101bba601e299c87a9c20ac9bbcd79b9b069b973 Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Tue, 13 Jun 2023 14:02:17 +0200 Subject: [PATCH] Prevent some Null Pointer Exception --- .../e/drive/contentScanner/LocalContentScanner.java | 4 +++- .../e/drive/contentScanner/RemoteContentScanner.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/contentScanner/LocalContentScanner.java b/app/src/main/java/foundation/e/drive/contentScanner/LocalContentScanner.java index 5b4a7be4..4410d639 100644 --- a/app/src/main/java/foundation/e/drive/contentScanner/LocalContentScanner.java +++ b/app/src/main/java/foundation/e/drive/contentScanner/LocalContentScanner.java @@ -93,6 +93,8 @@ public class LocalContentScanner extends AbstractContentScanner{ @Override protected boolean isFileMatchingSyncedFileState(@NonNull File file, @NonNull SyncedFileState fileState) { final String filePath = CommonUtils.getLocalPath(file); - return fileState.getLocalPath().equals(filePath); + final String localPath = fileState.getLocalPath(); + + return localPath != null && localPath.equals(filePath); } } \ No newline at end of file diff --git a/app/src/main/java/foundation/e/drive/contentScanner/RemoteContentScanner.java b/app/src/main/java/foundation/e/drive/contentScanner/RemoteContentScanner.java index dcf48db7..9c9ec22c 100644 --- a/app/src/main/java/foundation/e/drive/contentScanner/RemoteContentScanner.java +++ b/app/src/main/java/foundation/e/drive/contentScanner/RemoteContentScanner.java @@ -99,7 +99,9 @@ public class RemoteContentScanner extends AbstractContentScanner { @Override protected boolean isFileMatchingSyncedFileState(@NonNull RemoteFile file, @NonNull SyncedFileState fileState) { - return fileState.getRemotePath().equals(file.getRemotePath()); + String remotePath = fileState.getRemotePath(); + + return remotePath != null && remotePath.equals(file.getRemotePath()); } @Override -- GitLab