From 85499313606a157537eb1dc7fa03501196c4c7e7 Mon Sep 17 00:00:00 2001 From: Arthur van der Staaij <32672293+avdstaaij@users.noreply.github.com> Date: Sat, 26 Jun 2021 21:43:50 +0200 Subject: [PATCH] Fixed main menu crash (#4270) Fixed a critical bug where the game would crash when any option was picked in the main menu. The bug was introduced by 823e6ffc2a4d14c04a661e2e0f8c2253c0d0844a. --- core/src/com/unciv/models/stats/Stats.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/com/unciv/models/stats/Stats.kt b/core/src/com/unciv/models/stats/Stats.kt index c419837eef..e0a48d9d94 100644 --- a/core/src/com/unciv/models/stats/Stats.kt +++ b/core/src/com/unciv/models/stats/Stats.kt @@ -119,7 +119,7 @@ open class Stats() { private val statRegex = Regex(statRegexPattern) private val entireStringRegexPattern = Regex("$statRegexPattern(, $statRegexPattern)*") fun isStats(string:String): Boolean { - if (string[0] != '+' && string[0] != '-') return false // very quick negative check before the heavy Regex + if (string.isEmpty() || string[0] !in "+-") return false // very quick negative check before the heavy Regex return entireStringRegexPattern.matches(string) } fun parse(string:String):Stats{