sounds: check if total weight >= 1, #63

This commit is contained in:
Bixilon 2021-12-15 08:14:50 +01:00
parent 543dda505a
commit 1bfb4aff68
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 2 additions and 0 deletions

View File

@ -35,6 +35,7 @@ class WeightedBakedModel(
totalWeight += weight
}
check(totalWeight > 0) { "Weight must be >= 1" }
this.totalWeight = totalWeight
}

View File

@ -32,6 +32,7 @@ data class SoundType(
totalWeight += sound.weight
}
check(totalWeight >= 1) { "Weight must be >= 1" }
this.totalWeight = totalWeight
}