From 8ae245b4002111ef362c695ee461e00b3b969a11 Mon Sep 17 00:00:00 2001 From: Helium314 Date: Fri, 6 Sep 2024 21:57:25 +0200 Subject: [PATCH] don't crash if quest is not in questTypeRegistry fixes #639 --- .../screens/settings/quest_selection/QuestSelection.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/westnordost/streetcomplete/screens/settings/quest_selection/QuestSelection.kt b/app/src/main/java/de/westnordost/streetcomplete/screens/settings/quest_selection/QuestSelection.kt index 9c92dd7558..1b49a19e02 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/screens/settings/quest_selection/QuestSelection.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/screens/settings/quest_selection/QuestSelection.kt @@ -9,5 +9,7 @@ import de.westnordost.streetcomplete.data.quest.QuestTypeRegistry data class QuestSelection(val questType: QuestType, var selected: Boolean, val enabledInCurrentCountry: Boolean, val prefs: Preferences) { fun isInteractionEnabled(questTypeRegistry: QuestTypeRegistry) = prefs.getBoolean(Prefs.EXPERT_MODE, false) - || (questType !is OsmNoteQuestType && questTypeRegistry.getOrdinalOf(questType)!! < EE_QUEST_OFFSET) + // not sure how questTypeRegistry can be empty / not contain a quest initially coming from that repository + // but it can happen, so just don't crash, see https://github.com/Helium314/SCEE/issues/639 + || (questType !is OsmNoteQuestType && (questTypeRegistry.getOrdinalOf(questType) ?: EE_QUEST_OFFSET) < EE_QUEST_OFFSET) }