浏览代码

Fix crash when a preference doesn't have a title (e.g. info preference)

arkon 4 年之前
父节点
当前提交
3133a63cf8
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchHelper.kt

+ 4 - 4
app/src/main/java/eu/kanade/tachiyomi/ui/setting/search/SettingsSearchHelper.kt

@@ -81,8 +81,8 @@ object SettingsSearchHelper {
         pref: Preference,
         breadcrumbs: String = ""
     ) {
-        when (pref) {
-            is PreferenceGroup -> {
+        when {
+            pref is PreferenceGroup -> {
                 val breadcrumbsStr = addLocalizedBreadcrumb(breadcrumbs, "${pref.title}")
 
                 for (x in 0 until pref.preferenceCount) {
@@ -90,7 +90,7 @@ object SettingsSearchHelper {
                     getSettingSearchResult(ctrl, subPref, breadcrumbsStr) // recursion
                 }
             }
-            is PreferenceCategory -> {
+            pref is PreferenceCategory -> {
                 val breadcrumbsStr = addLocalizedBreadcrumb(breadcrumbs, "${pref.title}")
 
                 for (x in 0 until pref.preferenceCount) {
@@ -98,7 +98,7 @@ object SettingsSearchHelper {
                     getSettingSearchResult(ctrl, subPref, breadcrumbsStr) // recursion
                 }
             }
-            else -> {
+            (pref.title != null) -> {
                 // Is an actual preference
                 val title = pref.title.toString()
                 val summary = if (pref.summary != null) pref.summary.toString() else ""