Fixed crash on startup when host address is empty (#6078)

This commit is contained in:
Patrick Geneva 2021-03-06 05:40:46 -05:00 committed by GitHub
parent 88bd826168
commit 95d88d6a82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Mango'
pkgNameSuffix = 'all.mango'
extClass = '.Mango'
extVersionCode = 1
extVersionCode = 2
libVersion = '1.2'
}

View File

@ -306,7 +306,7 @@ class Mango : ConfigurableSource, HttpSource() {
// We strip the last slash since we will append it above
private fun getPrefBaseUrl(): String {
var path = preferences.getString(ADDRESS_TITLE, ADDRESS_DEFAULT)!!
if (path.last() == '/') {
if (path.isNotEmpty() && path.last() == '/') {
path = path.substring(0, path.length - 1)
}
return path