]> granicus.if.org Git - nethack/commitdiff
Fix use of data from deleted vault teleport trap
authorPasi Kallinen <paxed@alt.org>
Sun, 15 Nov 2015 16:55:09 +0000 (18:55 +0200)
committerPasi Kallinen <paxed@alt.org>
Sun, 15 Nov 2015 16:55:09 +0000 (18:55 +0200)
src/teleport.c

index 8f7b5860a1479249fb8d231dcb84e8e742dbb707..5faf0135cdb88dbf6ac553468704fbf4432dd4f0 100644 (file)
@@ -490,12 +490,14 @@ int
 dotele()
 {
     struct trap *trap;
+    boolean trap_once = FALSE;
 
     trap = t_at(u.ux, u.uy);
     if (trap && (!trap->tseen || trap->ttyp != TELEP_TRAP))
         trap = 0;
 
     if (trap) {
+        trap_once = trap->once; /* trap may get deleted, save this */
         if (trap->once) {
             pline("This is a vault teleport, usable once only.");
             if (yn("Jump in?") == 'n')
@@ -569,7 +571,7 @@ dotele()
     }
 
     if (next_to_u()) {
-        if (trap && trap->once)
+        if (trap && trap_once)
             vault_tele();
         else
             tele();