1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-08-11 23:21:37 +01:00

Bugpaper: check if uamul is null before trying to dereference it.

Some that reads through inventory directly (like theft) sometimes hits objects that claim to be worn amulets but aren't.

This is probably a bad sign, but we can deal with it more gracefully than crashes.
This commit is contained in:
chris 2022-04-20 16:49:26 -04:00
parent 73a50a46be
commit 63c0685de1

View file

@ -911,7 +911,11 @@ void
Amulet_off()
{
takeoff_mask &= ~W_AMUL;
if(!uamul){
impossible("Amulet_off() was called, but no amulet is worn.");
return;
}
switch(uamul->otyp) {
case AMULET_OF_ESP:
/* need to update ability before calling see_monsters() */