aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeapo <mohamed@zenadi.com>2017-10-30 22:49:25 +0100
committerzeapo <mohamed@zenadi.com>2017-10-30 22:49:25 +0100
commit57358a86accb9424144314394212951570fc2085 (patch)
tree4f53295b35c1345f4c32fb05e05eb221f450f15a
parentb6cb649f7ce89915aa59ff903aa43200e439e3c6 (diff)
fix a potential NPE
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java3
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java2
2 files changed, 2 insertions, 3 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
index 16bf4547..9578df0d 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
@@ -377,8 +377,7 @@ public class AutofillService extends AccessibilityService {
}
private ArrayList<File> searchPasswords(File path, String appName) {
- ArrayList<File> passList
- = PasswordRepository.getFilesList(path);
+ ArrayList<File> passList = PasswordRepository.getFilesList(path);
if (passList.size() == 0) return new ArrayList<>();
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java
index 990aec39..e232b8a0 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRepository.java
@@ -166,7 +166,7 @@ public class PasswordRepository {
* @return the list of gpg files in that directory
*/
public static ArrayList<File> getFilesList(File path) {
- if (!path.exists()) return new ArrayList<>();
+ if (path == null || !path.exists()) return new ArrayList<>();
Log.d("REPO", "current path: " + path.getPath());
List<File> directories = Arrays.asList(path.listFiles((FileFilter) FileFilterUtils.directoryFileFilter()));