Page 1 of 1

[since old times] CheckLocalView called on NULL pointer

Posted: Sat May 14, 2016 5:39 pm
by Edward-san
While I was investigating a crash in a zandronum ticket, I noticed that repeating the 'dying npc' process in zdoom, no crash happened in src/g_strife/a_strifeitems.cpp:

Code: Select all

if (dropper->target->CheckLocalView (consoleplayer))
even though dropper->target is NULL. Inside CheckLocalView there's no direct access to any member variable, but it's still undefined behavior according to the C++ Standard. What do you think? Is it correct that the npc has no target when it dies?

Steps for zdoom:
- (developer) put a breakpoint at the line above;
- load zdoom with: `zdoom -iwad doom2.wad -file npccrash_01.wad -warp 01 -skill 4` ;
- press '+attack' once against one marine and wait that it dies because of the wounds.

Re: [since old times] CheckLocalView called on NULL pointer

Posted: Sun May 15, 2016 1:15 am
by Graf Zahl
As you say, it's undefined so better add a check to both places where this happens.