diff options
author | Mohamed Zenadi <mohamed@zenadi.com> | 2015-08-03 00:01:24 +0200 |
---|---|---|
committer | Mohamed Zenadi <mohamed@zenadi.com> | 2015-08-03 00:03:37 +0200 |
commit | feb8eefcc4d0825568d158199c490ff4998c9ad5 (patch) | |
tree | b4bca060903a3130deb8a2f12b20108e2d0c6231 | |
parent | d57246adb1e376e3ba37ba77f535bce78a75a8ee (diff) |
fix potential NPEv1.2.0.27
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordStore.java | 8 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_pwdstore.xml | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java index b72fa1ca..4602cf59 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java @@ -449,9 +449,13 @@ public class PasswordStore extends AppCompatActivity { case CLONE_REPO_BUTTON: // duplicate code if (settings.getBoolean("git_external", false) && settings.getString("git_external_repo", null) != null) { - File dir = new File(settings.getString("git_external_repo", null)); + String externalRepoPath = settings.getString("git_external_repo", null); + File dir = externalRepoPath != null ? new File(externalRepoPath) : null; - if (dir.exists() && dir.isDirectory() && !FileUtils.listFiles(dir, null, true).isEmpty() && + if (dir != null && + dir.exists() && + dir.isDirectory() && + !FileUtils.listFiles(dir, null, true).isEmpty() && !PasswordRepository.getPasswords(dir).isEmpty()) { PasswordRepository.closeRepository(); checkLocalRepository(); diff --git a/app/src/main/res/layout/activity_pwdstore.xml b/app/src/main/res/layout/activity_pwdstore.xml index 20878286..84c7af06 100644 --- a/app/src/main/res/layout/activity_pwdstore.xml +++ b/app/src/main/res/layout/activity_pwdstore.xml @@ -9,6 +9,6 @@ android:id="@+id/main_layout" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical"></LinearLayout> + android:orientation="vertical"/> </RelativeLayout> |