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

@@ -257,7 +257,7 @@ struct obj {
/* 'missile' aspect is up to the caller and does not imply is_missile();
rings might be launched as missiles when being scattered by an explosion */
#define stone_missile(o) \
((o) && (objects[(o)->otyp].oc_material == GEMSTONE \
((objects[(o)->otyp].oc_material == GEMSTONE \
|| (objects[(o)->otyp].oc_material == MINERAL)) \
&& (o)->oclass != RING_CLASS)