alternate fix for merge_choice() with Null invent

merge_choice() doesn't need the address of its list argument, just to
return Null if that list is Null.  Could have been solved by having
its callers check for Null invent and skip the call if necessary but
this is simpler.

Finishes reverting commit 378648bd9c.
This commit is contained in:
PatR
2024-02-01 14:38:28 -08:00
parent 16f4bdb5a6
commit 899cca50ef
2 changed files with 3 additions and 1 deletions

View File

@@ -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;

View File

@@ -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