확률을 입력하지 않아서 crash 나는 버그 수정

This commit is contained in:
klaus 2024-05-22 19:33:15 +09:00
parent b876695adc
commit 6fac6ecd4d
1 changed files with 12 additions and 0 deletions

View File

@ -131,6 +131,18 @@ class RouletteSettingsViewModel(private val repository: RouletteRepository) : Ba
return false return false
} }
if (option.percentage.isBlank()) {
_toastLiveData.value = "옵션의 확률은 빈칸일 수 없습니다."
_isLoading.value = false
return false
}
if (option.percentage.toFloat() <= 0f) {
_toastLiveData.value = "옵션의 확률은 0%보다 커야합니다."
_isLoading.value = false
return false
}
totalPercentage += option.percentage.toFloat() totalPercentage += option.percentage.toFloat()
} }