JakeWharton/u2020

Setting invalid custom endpoint breaks the app

bradroid opened this issue · 1 comments

Setting endpoint to custom with value that is not parseable (e.g "saffga") will make the app crash. It will crash on every consequent startup until the app data is cleared.
The reason is that the user inputed string is saved to @ApiEndpoint String preference, which is later read by provideHttpUrl method in DebugApiModule. The method tries to parse the String into HttpUrl but invalid Strings are parsed to null value. When null HttpUrl is provided as a base url when building retrofit instance, the app will crash.

Fix: Make sure user provided custom URL is parseable. Additional validation is required when custom endpoint is set by the user(within DebugView, check if it is parseable by HttpUrl.parse() method). I've made pull request for this but I guess I'm not allowed to push anything to this repo.

To submit a pull request, fork the repository and push your changes to your fork. You'll be able to open a PR once you've pushed.