Page 1 of 1

[2.8.0] Crash on "bad" item pickup

Posted: Tue Feb 09, 2016 2:43 am
by _mental_
There is no check for actual type in A_GiveInventory() and bunch of related functions. The following code will lead to a crash when player will try to pickup an item.
Spoiler: Example of 'give non-inventory actor' issue
You can try it yourself using the attached file. Launch with this command line zdoom -iwad doom -file inventory_crash.wad +map e1m1 +summon a and go forward.

EDIT:
It's worth noting that scripting doesn't have this issue as actor inheritance is checked and an error is printed to console.
That's why I made a pull request with the fix to maint instead of master branch.
Also, I added no error message as it will be printed on every frame (not just once like in scripting) flooding the log quickly.

Re: [2.8.0] Crash on "bad" item pickup

Posted: Tue Feb 09, 2016 3:19 am
by Graf Zahl
Just for confirmation: Master prints an error message but doesn't abort.

Re: [2.8.0] Crash on "bad" item pickup

Posted: Tue Feb 09, 2016 3:22 am
by _mental_
Master ignores the pickup state in the given example. With the exception of the error message my change makes both versions work the same.