Fix segfault when looking at detected monster hiding under unknown armor
This segfault happened when a detected monster such as a garter snake was hiding under an unknown/unseen armor of a type that has no description field (eg. a leather armor), and you farlooked at the monster. At the same time, simplifies the code a tiny bit.
This commit is contained in:
+4
-4
@@ -268,7 +268,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
|||||||
register struct objclass *ocl = &objects[typ];
|
register struct objclass *ocl = &objects[typ];
|
||||||
int nn = ocl->oc_name_known, omndx = obj->corpsenm;
|
int nn = ocl->oc_name_known, omndx = obj->corpsenm;
|
||||||
const char *actualn = OBJ_NAME(*ocl);
|
const char *actualn = OBJ_NAME(*ocl);
|
||||||
const char *dn = OBJ_DESCR(*ocl);
|
const char *dn = OBJ_DESCR(*ocl) ? OBJ_DESCR(*ocl) : actualn;
|
||||||
const char *un = ocl->oc_uname;
|
const char *un = ocl->oc_uname;
|
||||||
boolean pluralize = (obj->quan != 1L) && !(cxn_flags & CXN_SINGULAR);
|
boolean pluralize = (obj->quan != 1L) && !(cxn_flags & CXN_SINGULAR);
|
||||||
boolean known, dknown, bknown;
|
boolean known, dknown, bknown;
|
||||||
@@ -327,15 +327,15 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
|||||||
Strcpy(buf, (obj->spe < 3) ? "moist " : "wet ");
|
Strcpy(buf, (obj->spe < 3) ? "moist " : "wet ");
|
||||||
|
|
||||||
if (!dknown)
|
if (!dknown)
|
||||||
Strcat(buf, dn ? dn : actualn);
|
Strcat(buf, dn);
|
||||||
else if (nn)
|
else if (nn)
|
||||||
Strcat(buf, actualn);
|
Strcat(buf, actualn);
|
||||||
else if (un) {
|
else if (un) {
|
||||||
Strcat(buf, dn ? dn : actualn);
|
Strcat(buf, dn);
|
||||||
Strcat(buf, " called ");
|
Strcat(buf, " called ");
|
||||||
Strcat(buf, un);
|
Strcat(buf, un);
|
||||||
} else
|
} else
|
||||||
Strcat(buf, dn ? dn : actualn);
|
Strcat(buf, dn);
|
||||||
/* If we use an() here we'd have to remember never to use */
|
/* If we use an() here we'd have to remember never to use */
|
||||||
/* it whenever calling doname() or xname(). */
|
/* it whenever calling doname() or xname(). */
|
||||||
if (typ == FIGURINE && omndx != NON_PM) {
|
if (typ == FIGURINE && omndx != NON_PM) {
|
||||||
|
|||||||
Reference in New Issue
Block a user