]> granicus.if.org Git - nethack/commitdiff
dragon armor fix
authorPatR <rankin@nethack.org>
Sat, 25 Dec 2021 22:31:33 +0000 (14:31 -0800)
committerPatR <rankin@nethack.org>
Sat, 25 Dec 2021 22:31:33 +0000 (14:31 -0800)
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
src/artifact.c

index 20e485d38c0deb9f084d54abed9c8ba841c3d3b2..60ed6af5790d1432edd2b08328794f883d1d64c4 100644 (file)
@@ -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] */
index d944876424debfa1ab6dc3483c4eda25d5cffee0..413c8f6d237c02b1571cd6a97d196b86ccdf05d5 100644 (file)
@@ -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)) {