Fix crash when setting empty image cache size or seek increments

This commit is contained in:
Jarne Demeulemeester 2022-09-08 13:29:26 +02:00
parent 1f56408c14
commit 385f097beb
No known key found for this signature in database
GPG key ID: B61B7B150DB6A6D2
2 changed files with 3 additions and 3 deletions

View file

@ -21,7 +21,7 @@ class GlideModule : AppGlideModule() {
val use = preferences.getBoolean(Constants.PREF_IMAGE_CACHE, true)
if (use) {
val sizeMb = preferences.getString(Constants.PREF_IMAGE_CACHE_SIZE, "${Constants.DEFAULT_CACHE_SIZE}")?.toInt()!!
val sizeMb = preferences.getString(Constants.PREF_IMAGE_CACHE_SIZE, Constants.DEFAULT_CACHE_SIZE.toString())!!.toIntOrNull() ?: Constants.DEFAULT_CACHE_SIZE
val sizeB = 1024L * 1024 * sizeMb
Timber.d("Setting image cache to use $sizeMb MB of disk space")

View file

@ -37,10 +37,10 @@ constructor(
val playerSeekBackIncrement = sharedPreferences.getString(
Constants.PREF_PLAYER_SEEK_BACK_INC,
DEFAULT_SEEK_BACK_INCREMENT_MS.toString()
)!!.toLong()
)!!.toLongOrNull() ?: DEFAULT_SEEK_BACK_INCREMENT_MS
val playerSeekForwardIncrement = sharedPreferences.getString(
Constants.PREF_PLAYER_SEEK_FORWARD_INC,
DEFAULT_SEEK_FORWARD_INCREMENT_MS.toString()
)!!.toLong()
)!!.toLongOrNull() ?: DEFAULT_SEEK_FORWARD_INCREMENT_MS
val mpvDisableHwDec = sharedPreferences.getBoolean("mpv_disable_hwdec", false)
}