Guard against merge segfaults

Trying to throw a quivered object resulted in a segfault, when
the code tried to merge the quivered object into itself.
This commit is contained in:
Pasi Kallinen
2015-04-14 08:55:43 +03:00
parent 31eed002c3
commit f1a5de16d9

View File

@@ -2540,6 +2540,7 @@ mergable(otmp, obj) /* returns TRUE if obj & otmp can be merged */
register struct obj *otmp, *obj;
{
int objnamelth = 0, otmpnamelth = 0;
if (obj == otmp) return FALSE; /* already the same object */
if (obj->otyp != otmp->otyp) return FALSE;
/* coins of the same kind will always merge */
if (obj->oclass == COIN_CLASS) return TRUE;