From c4724fd27127dec14b40e4fce1dc062d8710acd5 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 25 Dec 2021 14:31:33 -0800 Subject: [PATCH] dragon armor fix Fix a segfault when polymorphed into a dragon and using ^X. One inconsistency I've spotted that I hadn't noticed earlier: if you wear red dragon scales/mail you obtain infravision ability, but if polymorph into a red dragon, you don't. --- include/youprop.h | 2 +- src/artifact.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/youprop.h b/include/youprop.h index 20e485d38..60ed6af57 100644 --- a/include/youprop.h +++ b/include/youprop.h @@ -67,7 +67,7 @@ #define HSick_resistance u.uprops[SICK_RES].intrinsic #define ESick_resistance u.uprops[SICK_RES].extrinsic #define Sick_resistance (HSick_resistance || ESick_resistance \ - || defends(AD_DISE, uwep)) + || defended(&g.youmonst, AD_DISE)) /* Intrinsics only */ #define Invulnerable u.uprops[INVULNERABLE].intrinsic /* [Tom] */ diff --git a/src/artifact.c b/src/artifact.c index d94487642..413c8f6d2 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -396,6 +396,8 @@ defends(int adtyp, struct obj *otmp) { struct artifact *weap; + if (!otmp) + return FALSE; if ((weap = get_artifact(otmp)) != 0) return (boolean) (weap->defn.adtyp == adtyp); if (Is_dragon_armor(otmp)) { -- 2.50.0