From a1618a6556a049efe9a1ae3af4a0295cea39c166 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 28 Mar 2023 18:31:14 +0200 Subject: [PATCH] Fix crash when restoring old backups --- .../java/com/github/libretube/helpers/PreferenceHelper.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/helpers/PreferenceHelper.kt b/app/src/main/java/com/github/libretube/helpers/PreferenceHelper.kt index 621415a70..97f83a894 100644 --- a/app/src/main/java/com/github/libretube/helpers/PreferenceHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/PreferenceHelper.kt @@ -64,7 +64,9 @@ object PreferenceHelper { } fun getInt(key: String?, defValue: Int): Int { - return settings.getInt(key, defValue) + return runCatching { + settings.getInt(key, defValue) + }.getOrElse { settings.getLong(key, defValue.toLong()).toInt() } } fun getLong(key: String?, defValue: Long): Long {