null pointer dereference in do_name.c

fixes #534
This commit is contained in:
nhmall
2021-06-15 15:49:31 -04:00
parent 57e970b227
commit 5ac913e035
2 changed files with 3 additions and 1 deletions

View File

@@ -2098,7 +2098,7 @@ mon_pmname(struct monst *mon)
const char *
obj_pmname(struct obj *obj)
{
if (has_omonst(obj))
if (has_omonst(obj) && OMONST(obj)->data)
return mon_pmname(OMONST(obj));
if ((obj->otyp == CORPSE || obj->otyp == STATUE || obj->otyp == FIGURINE)