Safely check if other is NULL when triggering
Some checks failed
CodeQL / Analyze (push) Waiting to run
Build branch / build-all (push) Failing after 17s

This commit is contained in:
smallmodel 2025-01-18 13:23:30 +01:00 committed by GitHub
parent 1ea273fba0
commit 1a71d44b43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -440,6 +440,12 @@ void Trigger::TriggerStuff(Event *ev)
ScriptError("trigger '%s' triggered by self", TargetName().c_str());
}
// Fixed in OPM
// Safety check
if (other == NULL) {
ScriptError("trigger '%s' triggered by NULL entity", TargetName().c_str());
}
// Always respond to activate messages from the world since they're probably from
// the "trigger" command
if (!respondTo(other) && (other != world || *ev != EV_Activate)
@ -894,6 +900,12 @@ void TriggerAll::TriggerStuff(Event *ev)
ScriptError("trigger '%s' triggered by self", TargetName().c_str());
}
// Fixed in OPM
// Safety check
if (other == NULL) {
ScriptError("trigger '%s' triggered by NULL entity", TargetName().c_str());
}
// Always respond to activate messages from the world since they're probably from
// the "trigger" command
if (!respondTo(other) && !((other == world) && (*ev == EV_Activate))