Commit d5850f9c authored by Mygod's avatar Mygod

Fix FileNotFoundException crash

parent 33e5d4dd
...@@ -130,7 +130,7 @@ class GlobalSettingsPreferenceFragment : PreferenceFragmentCompat() { ...@@ -130,7 +130,7 @@ class GlobalSettingsPreferenceFragment : PreferenceFragmentCompat() {
try { try {
// we read and persist all its content here to avoid content URL permission issues // we read and persist all its content here to avoid content URL permission issues
hosts.text = activity.contentResolver.openInputStream(data!!.data!!)!!.bufferedReader().readText() hosts.text = activity.contentResolver.openInputStream(data!!.data!!)!!.bufferedReader().readText()
} catch (e: RuntimeException) { } catch (e: Exception) {
activity.snackbar(e.readableMessage).show() activity.snackbar(e.readableMessage).show()
} }
} }
......
...@@ -325,7 +325,7 @@ class MainPreferenceFragment : LeanbackPreferenceFragmentCompat(), ShadowsocksCo ...@@ -325,7 +325,7 @@ class MainPreferenceFragment : LeanbackPreferenceFragmentCompat(), ShadowsocksCo
try { try {
// we read and persist all its content here to avoid content URL permission issues // we read and persist all its content here to avoid content URL permission issues
hosts.text = context.contentResolver.openInputStream(data!!.data!!)!!.bufferedReader().readText() hosts.text = context.contentResolver.openInputStream(data!!.data!!)!!.bufferedReader().readText()
} catch (e: RuntimeException) { } catch (e: Exception) {
Toast.makeText(context, e.readableMessage, Toast.LENGTH_SHORT).show() Toast.makeText(context, e.readableMessage, Toast.LENGTH_SHORT).show()
} }
} }
......
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