Fix segfault when first mobj in overlaycap is removed
When overlays are removed from the game through P_RemoveMobj
, there's a small chance that the mobj is not removed properly from overlaycap
, notably if it's in the first spot in the linked list. This causes the game to crash when P_RunOverlays
is called afterwards, since the first value in overlaycap
would not be valid anymore. The cause of this bug is due to a missing special check that checks the first entry in the list, as the iterator only checks the following value through hnext
and thus misses to check the first value.