Fix a potential endless function call loop in platform code
authorMario <mario@smbclan.net>
Wed, 15 Mar 2017 02:34:42 +0000 (12:34 +1000)
committerMario <mario@smbclan.net>
Wed, 15 Mar 2017 02:34:42 +0000 (12:34 +1000)
qcsrc/common/triggers/subs.qc

index 67eb18a..b7cea32 100644 (file)
@@ -87,7 +87,7 @@ void SUB_CalcMoveDone(entity this)
        SUB_SETORIGIN (this, this.finaldest);
        this.SUB_VELOCITY = '0 0 0';
        this.SUB_NEXTTHINK = -1;
-       if (this.think1)
+       if (this.think1 && this.think1 != SUB_CalcMoveDone)
                this.think1 (this);
 }
 
@@ -310,7 +310,7 @@ void SUB_CalcAngleMoveDone(entity this)
        this.angles = this.finalangle;
        this.SUB_AVELOCITY = '0 0 0';
        this.SUB_NEXTTHINK = -1;
-       if (this.think1)
+       if (this.think1 && this.think1 != SUB_CalcAngleMoveDone) // avoid endless loops
                this.think1 (this);
 }