remove obj guard from stone_missile(obj) macro

Checking the callers:
toss_up() would have segfaulted prior to use of stone_missile() if obj were NULL.
thitu() now has a guard prior to use of stone_missile()
ohitmon() would have crashed from earlier dereference otmp->dknown if it were NULL,
   otmp arg is declared nonnull
thitm() now has a guard prior to use of stone_missile().
hmon_hitmon_do_hit() null obj takes a different code path than the code path
    using stone_missile(); comment asserting that added
This commit is contained in:
nhmall
2023-12-16 07:58:44 -05:00
parent 0099098d35
commit 70dcab833d
6 changed files with 11 additions and 9 deletions

View File

@@ -17,8 +17,7 @@
static struct artifact *get_artifact(struct obj *) NONNULL; /* never returns null */
/* #define get_artifact(o) \
(((o) && ((o)->artifact > 0 && (o)->artifact < AFTER_LAST_ARTIFACT)) \
? &artilist[(int) (o)->oartifact] \
(((o) && (o)->oartifact) ? &artilist[(int) (o)->oartifact] \
: &artilist[ART_NONARTIFACT]) */
static boolean bane_applies(const struct artifact *, struct monst *) NONNULLARG12;
@@ -2546,8 +2545,7 @@ is_art(struct obj *obj, int art)
}
/* #define get_artifact(o) \
(((o) && ((o)->artifact > 0 && (o)->artifact < AFTER_LAST_ARTIFACT)) \
? &artilist[(int) (o)->oartifact] \
(((o) && (o)->oartifact) ? &artilist[(int) (o)->oartifact] \
: &artilist[ART_NONARTIFACT]) */
static struct artifact *