Fix duration regex, returning null on first checker (#218)

This commit is contained in:
Jace 2022-11-21 15:32:32 +08:00 committed by GitHub
parent a8f3d18c2e
commit 9bca7a0780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1143,9 +1143,9 @@ fun getDurationFromString(input: String?): Int? {
if (values.size == 3) {
val hours = values[1].toIntOrNull()
val minutes = values[2].toIntOrNull()
return if (minutes != null && hours != null) {
hours * 60 + minutes
} else null
if (minutes != null && hours != null) {
return hours * 60 + minutes
}
}
}
Regex("([0-9]*)m").find(cleanInput)?.groupValues?.let { values ->