]> granicus.if.org Git - nethack/commitdiff
Prevent segfault when not wielding anything
authorPasi Kallinen <paxed@alt.org>
Mon, 6 Apr 2020 15:09:47 +0000 (18:09 +0300)
committerPasi Kallinen <paxed@alt.org>
Mon, 6 Apr 2020 15:09:47 +0000 (18:09 +0300)
src/insight.c

index 1bd5a2e171b37f181a6e1a4bfb3337b6acd2850a..9149ceece9305228ba57ea80d6c4a1419445f443 100644 (file)
@@ -1077,7 +1077,7 @@ int final;
      * Skill with current weapon.  Might help players who've never
      * noticed #enhance or decided that it was pointless.
      */
-    if ((wtype = weapon_type(uwep)) != P_NONE && !is_ammo(uwep)) {
+    if (uwep && (wtype = weapon_type(uwep)) != P_NONE && !is_ammo(uwep)) {
         char sklvlbuf[20];
         int sklvl = P_SKILL(wtype);
         boolean hav = (sklvl != P_UNSKILLED && sklvl != P_SKILLED);