dumptruckDS / progs_dump_qc

This is no longer the most current version of the source. Visit the URL below for the most current version.
https://github.com/progs-dump-dev/progs_dump
GNU General Public License v2.0
60 stars 13 forks source link

[Bug] `func_monster_spawner` crashes the game if telefrag check succeeds on first use #155

Closed paavohuhtala closed 3 years ago

paavohuhtala commented 3 years ago

func_monster_spawner has a telefrag check in the think_mobot function, which checks if there are any damageable entities within 128 units. If there are any, it will delay the check by 1 second and tries again.

However, there's a problem: if this telefrag check finds any entities the first time the object is used, it will crash the game (or at least QuakeSpasm Spiked) with the error PR_ExecuteProgram: NULL function. This is because the next update is scheduled with self.nextthink

self.nextthink = time + 1; //delay the spawn by some amount;

but at this point in the field self.think is not guaranteed to be set, as it is only set at the end of the function.

The bug can be fixed by adding self.think = think_mobot; to the line before the assignment to self.nextthink.

paavohuhtala commented 3 years ago

Here's the (1-line) fix in my fork: https://github.com/paavohuhtala/progs_dump_qc/commit/8c0f3c1490b5aa556bb585b90a843f24f60b4285

paavohuhtala commented 3 years ago

This was fixed in d4916bf91668e8cf9f7c73162b52892b16a1ff47, closing.