mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-24 18:06:04 +07:00
Added exception to catch the situation causing #11404
This commit is contained in:
parent
027e56d6a7
commit
08bfa381a1
@ -201,12 +201,17 @@ class UniqueValidator(val ruleset: Ruleset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Maps uncompliant parameters to their required types */
|
/** Maps uncompliant parameters to their required types */
|
||||||
private fun getComplianceErrors(
|
private fun getComplianceErrors(
|
||||||
unique: Unique,
|
unique: Unique,
|
||||||
): List<UniqueComplianceError> {
|
): List<UniqueComplianceError> {
|
||||||
if (unique.type == null) return emptyList()
|
if (unique.type == null) return emptyList()
|
||||||
val errorList = ArrayList<UniqueComplianceError>()
|
val errorList = ArrayList<UniqueComplianceError>()
|
||||||
for ((index, param) in unique.params.withIndex()) {
|
for ((index, param) in unique.params.withIndex()) {
|
||||||
|
// Trying to catch the error at #11404
|
||||||
|
if (unique.type.parameterTypeMap.size != unique.params.size) {
|
||||||
|
throw Exception("Unique ${unique.text} has ${unique.params.size} parameters, " +
|
||||||
|
"but its type ${unique.type} only ${unique.type.parameterTypeMap.size} parameters?!")
|
||||||
|
}
|
||||||
val acceptableParamTypes = unique.type.parameterTypeMap[index]
|
val acceptableParamTypes = unique.type.parameterTypeMap[index]
|
||||||
val errorTypesForAcceptableParameters =
|
val errorTypesForAcceptableParameters =
|
||||||
acceptableParamTypes.map { getParamTypeErrorSeverityCached(it, param) }
|
acceptableParamTypes.map { getParamTypeErrorSeverityCached(it, param) }
|
||||||
|
Loading…
Reference in New Issue
Block a user