Skip to content

Commit

Permalink
don't crash if quest is not in questTypeRegistry
Browse files Browse the repository at this point in the history
fixes #639
  • Loading branch information
Helium314 committed Sep 6, 2024
1 parent 438503d commit 8ae245b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 8ae245b

Please sign in to comment.