static analyzer bit for invent.c

src/invent.c(4882): warning: Dereferencing NULL pointer '((otmp))->oextra'.
This commit is contained in:
nhmall
2023-12-24 00:19:41 -05:00
parent 9b7694d2c5
commit 2e35f04c1d

View File

@@ -4880,7 +4880,9 @@ mergable(
if ((objnamelth != otmpnamelth
&& ((objnamelth && otmpnamelth) || obj->otyp == CORPSE))
|| (objnamelth && otmpnamelth
&& strncmp(ONAME(obj), ONAME(otmp), objnamelth)))
/* safe_oname could have returned ptr to "", verify before deref */
&& has_oname(obj) && has_oname(otmp)
&& strncmp(ONAME(obj), ONAME(otmp), objnamelth)))
return FALSE;
/* if one has an attached mail command, other must have same command */