Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CF: bugs in 0.92.7



I sent Mark a patch for the Armor and Weapon improvement scrolls crashing the
game yesterday.. They will only crash the game if you haven't marked an object
for them to be applied to.  The fix is to check the return value of
find_marked_object() to make sure it's not NULL in two places in apply.c

I've included the patch below for anyone else who needs it.

*** apply.c.orig	Thu Oct  3 15:02:08 1996
--- apply.c	Thu Oct  3 15:05:45 1996
***************
*** 767,776 ****
--- 767,780 ----
  	    new_draw_info(NDI_UNIQUE,0,op,"You have no weapon to enchant.\n");
  	    return 0;
  	}
      }
  #endif
+     if(!otmp) {
+       new_draw_info(NDI_UNIQUE, 0, op, "You need to mark a weapon object.");
+       return 0;
+     }
      if (otmp->type!=WEAPON) {
        new_draw_info(NDI_UNIQUE, 0,op,"Marked item is not a weapon");
        return 0;
      }
      new_draw_info(NDI_UNIQUE, 0,op,"Applied weapon builder.");
***************
*** 1942,1951 ****
--- 1946,1959 ----
  	|| op->inv->type==CLOAK
  	|| op->inv->type==BOOTS || op->inv->type==GLOVES
  	||op->inv->type==BRACERS || op->inv->type==SHIELD
  	||op->inv->type==HELMET)
  #endif
+     if(!armor) {
+       new_draw_info(NDI_UNIQUE, 0, op, "You need to mark an armor object.");
+       return 0;
+     }
      if (armor->type==ARMOUR
  	|| armor->type==CLOAK
  	|| armor->type==BOOTS || armor->type==GLOVES
  	||armor->type==BRACERS || armor->type==SHIELD
  	||armor->type==HELMET)