static analyzer bit for artifact.c
src/artifact.c(1589): warning C6011: Dereferencing NULL pointer 'magr'. The 'struct monst *magr' parameter to artifact_hit() can be Null if 'mdef' is youmonst. mdef is nonnull.
This commit is contained in:
@@ -1586,6 +1586,7 @@ artifact_hit(
|
||||
if (youattack) {
|
||||
healup(drain, 0, FALSE, FALSE);
|
||||
} else {
|
||||
assert(magr != 0);
|
||||
magr->mhp += drain;
|
||||
if (magr->mhp > magr->mhpmax)
|
||||
magr->mhp = magr->mhpmax;
|
||||
|
||||
Reference in New Issue
Block a user