summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorMatthew Wong <matt2566@hotmail.com>2016-03-07 20:35:24 -0500
committerMatthew Wong <matt2566@hotmail.com>2016-03-07 20:35:24 -0500
commitc9725d71868384193e470938850571a9f3cbde66 (patch)
tree0287d8c6d4b59c8174e7f248ac3a2a4c4fe99f2a /app/src
parentba3cf0162da2d7dc732c735c89949cc98faf120b (diff)
fix crash if url not found
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java16
1 files changed, 10 insertions, 6 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 145843fc..4cd91abd 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.java
@@ -200,6 +200,7 @@ public class AutofillService extends AccessibilityService {
setMatchingPasswords(appName, packageName, false);
} else {
+ // now we may have found a title but webViewURL could be null
packageName = setMatchingPasswords(webViewTitle, webViewURL, true);
appName = packageName;
isWeb = true;
@@ -255,6 +256,7 @@ public class AutofillService extends AccessibilityService {
}
}
+ // TODO split this into 2 functions for isWeb and !isWeb
private String setMatchingPasswords(String appName, String packageName, boolean isWeb) {
// Return the URL needed to open the corresponding Settings.
String settingsURL = packageName;
@@ -272,12 +274,14 @@ public class AutofillService extends AccessibilityService {
} else {
prefs = getSharedPreferences("autofill_web", Context.MODE_PRIVATE);
preference = defValue;
- Map<String, ?> prefsMap = prefs.getAll();
- for (String key : prefsMap.keySet()) {
- if ((webViewURL.toLowerCase().contains(key.toLowerCase()) || key.toLowerCase().contains(webViewURL.toLowerCase()))
- && !prefs.getString(key, null).equals("")) {
- preference = prefs.getString(key, null);
- settingsURL = key;
+ if (webViewURL != null) {
+ Map<String, ?> prefsMap = prefs.getAll();
+ for (String key : prefsMap.keySet()) {
+ if ((webViewURL.toLowerCase().contains(key.toLowerCase()) || key.toLowerCase().contains(webViewURL.toLowerCase()))
+ && !prefs.getString(key, null).equals("")) {
+ preference = prefs.getString(key, null);
+ settingsURL = key;
+ }
}
}
}