diff --git a/include/extern.h b/include/extern.h index 8a8bfce3f..cd0613e01 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1239,7 +1239,7 @@ extern Loot *sortloot(struct obj **, unsigned, boolean, boolean(*)(struct obj *)) NONNULLARG1; extern void unsortloot(Loot **) NONNULLARG1; extern void assigninvlet(struct obj *) NONNULLARG1; -extern struct obj *merge_choice(struct obj *, struct obj *) NONNULLPTRS; +extern struct obj *merge_choice(struct obj *, struct obj *) NONNULLARG2; extern int merged(struct obj **, struct obj **) NONNULLPTRS; extern void addinv_core1(struct obj *) NONNULLARG1; extern void addinv_core2(struct obj *) NONNULLARG1; diff --git a/src/invent.c b/src/invent.c index 20a7cf645..a2e99233e 100644 --- a/src/invent.c +++ b/src/invent.c @@ -786,6 +786,8 @@ merge_choice(struct obj *objlist, struct obj *obj) struct monst *shkp; unsigned save_nocharge; + if (!objlist) /* might be checking 'obj' against empty inventory */ + return (struct obj *) 0; if (obj->otyp == SCR_SCARE_MONSTER) /* punt on these */ return (struct obj *) 0; /* if this is an item on the shop floor, the attributes it will