Fix segfault when farlooking monster under generic object
A detected cave spider was hiding under a generic spellbook object; farlooking at it produced a segfault. OBJ_NAME is null for the generic objects, so don't try to strcmp it.
This commit is contained in:
@@ -2139,7 +2139,7 @@ ansimpleoname(struct obj* obj)
|
||||
any `known' and `dknown' checking necessary) */
|
||||
if (otyp == FAKE_AMULET_OF_YENDOR)
|
||||
otyp = AMULET_OF_YENDOR;
|
||||
if (objects[otyp].oc_unique
|
||||
if (objects[otyp].oc_unique && OBJ_NAME(objects[otyp])
|
||||
&& !strcmp(simpleoname, OBJ_NAME(objects[otyp]))) {
|
||||
/* the() will allocate another obuf[]; we want to avoid using two */
|
||||
Strcpy(simpleoname, obufp = the(simpleoname));
|
||||
|
||||
Reference in New Issue
Block a user