1
0
Fork 0

For #7522 Catch IllegalArgumentException when validating search string

master
mcarare 2020-01-10 12:20:43 +02:00 committed by Emily Kager
parent a58decd708
commit a72620ae07
2 changed files with 3 additions and 2 deletions

View File

@ -171,8 +171,7 @@ class AddSearchEngineFragment : Fragment(), CompoundButton.OnCheckedChangeListen
custom_search_engine_search_string_field.error = when {
searchString.isEmpty() ->
resources.getString(R.string.search_add_custom_engine_error_empty_search_string)
!searchString.contains("%s")
|| !searchString.contains("http") ->
!searchString.contains("%s") ->
resources.getString(R.string.search_add_custom_engine_error_missing_template)
else -> null
}

View File

@ -20,6 +20,8 @@ object SearchStringValidator {
client.fetch(request)
} catch (e: IOException) {
return Result.CannotReach
} catch (e: IllegalArgumentException) {
return Result.CannotReach
}
// read the response stream to ensure the body is closed correctly. workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1603114