Fix segfault on teleport while punished due to flooreffects

... deleting the ball & chain, but keeping a boulder in the pit.

Noticed a segfault when fuzzing, teleport while punished caused
a segfault via fill_pit -> flooreffects -> bury_objs -> unpunish,
and then the next line in teleds tried to look up uchain.

Guard against that particular case.

Fix the case of boulder being in a pit, triggered by you being in
a pit and a giant throwing a boulder on top of you.
This commit is contained in:
Pasi Kallinen
2020-04-18 16:51:35 +03:00
parent 9cdcf7b219
commit 2d43c6d62a
2 changed files with 3 additions and 2 deletions

View File

@@ -372,7 +372,7 @@ int teleds_flags;
the old position if allow_drag is true... */
u_on_newpos(nux, nuy); /* set u.<x,y>, usteed-><mx,my>; cliparound() */
fill_pit(u.ux0, u.uy0);
if (ball_active && uchain->where == OBJ_FREE)
if (ball_active && uchain && uchain->where == OBJ_FREE)
placebc(); /* put back the ball&chain if they were taken off map */
initrack(); /* teleports mess up tracking monsters without this */
update_player_regions();