Avoid crashes with incorrect condtionals (#9753)

This commit is contained in:
SeventhM 2023-07-05 12:57:06 -07:00 committed by GitHub
parent fdb07b06c1
commit d2dac66f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,8 +44,10 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
fun hasTriggerConditional(): Boolean {
if(conditionals.none()) return false
return conditionals.any{ conditional -> conditional.type!!.targetTypes
.any{ it.canAcceptUniqueTarget(UniqueTarget.TriggerCondition) } }
return conditionals.any{ conditional -> conditional.type?.targetTypes
?.any{ it.canAcceptUniqueTarget(UniqueTarget.TriggerCondition) }
?: false
}
}
fun isOfType(uniqueType: UniqueType) = uniqueType == type