Fix SEGV on undo past beginning of game.
authorTimo Korvola <tkorvola@iki.fi>
Sun, 21 Jan 2018 18:53:26 +0000 (20:53 +0200)
committerTimo Korvola <tkorvola@iki.fi>
Sun, 21 Jan 2018 18:53:26 +0000 (20:53 +0200)
src/common/fastmem.c

index 113370e15817429bbdaff889823f74a1bf7dd5b0..8ad1ee84db2de0cd02e3ce04d7bc265980c95b48 100644 (file)
@@ -867,8 +867,6 @@ static void mem_undiff (zbyte *diff, long diff_length, zbyte *dest)
  */
 int restore_undo (void)
 {
-    long pc = curr_undo->pc;
-
     if (f_setup.undo_slots == 0)       /* undo feature unavailable */
 
        return -1;
@@ -880,7 +878,7 @@ int restore_undo (void)
     /* undo possible */
 
     memcpy (zmp, prev_zmp, h_dynamic_size);
-    SET_PC (pc);
+    SET_PC (curr_undo->pc);
     sp = stack + STACK_SIZE - curr_undo->stack_size;
     fp = stack + curr_undo->frame_offset;
     frame_count = curr_undo->frame_count;