Commit da8e41d7 authored by Max Lv's avatar Max Lv

Handle exceptions when parsing per-app config string

parent 062dfb35
...@@ -160,6 +160,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC ...@@ -160,6 +160,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
if (!proxiedAppString.isEmpty) { if (!proxiedAppString.isEmpty) {
val editor = prefs.edit val editor = prefs.edit
val i = proxiedAppString.indexOf('\n') val i = proxiedAppString.indexOf('\n')
try {
if (i < 0) if (i < 0)
editor.putBoolean(Key.isBypassApps, proxiedAppString.toBoolean).putString(Key.proxied, "").apply() editor.putBoolean(Key.isBypassApps, proxiedAppString.toBoolean).putString(Key.proxied, "").apply()
else editor.putBoolean(Key.isBypassApps, proxiedAppString.substring(0, i).toBoolean) else editor.putBoolean(Key.isBypassApps, proxiedAppString.substring(0, i).toBoolean)
...@@ -170,6 +171,9 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC ...@@ -170,6 +171,9 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
loadingView.setVisibility(View.VISIBLE) loadingView.setVisibility(View.VISIBLE)
reloadApps() reloadApps()
return true return true
} catch {
case _: java.lang.IllegalArgumentException => // ignore
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment