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 823e6ffc2a.
This commit is contained in:
Arthur van der Staaij 2021-06-26 21:43:50 +02:00 committed by GitHub
parent 823e6ffc2a
commit 8549931360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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{