]> skyeroc.xyz Git - dgamelaunch/commitdiff
Ensure valid values in watching
authorPasi Kallinen <paxed@alt.org>
Sat, 17 Mar 2012 10:17:02 +0000 (12:17 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 17 Mar 2012 10:17:02 +0000 (12:17 +0200)
TODO
dgamelaunch.c

diff --git a/TODO b/TODO
index d982d5b3c493f709d3a87e01f34169f3c8b8971e..443d7f3c153cb52724291465a2fe3c3aed4c5b6a 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,6 @@
 
+-xterm title escape codes. Title strings defineable in config file?
+
 -allow setting banners for the internal menus, with the same method
  as normal user-defined menus, but only the banner is used from them.
  if no such menu is defined, then uses the default banner file.
index dd3d887c60a094c5b14754e8f13c1d77d0b84c34..17b6c2d621409fefb0fc914921c0b45e5e20e0d5 100644 (file)
@@ -1118,11 +1118,7 @@ inprogressmenu (int gameid)
        case ERR:
        case 'q': case 'Q':
         case '\x1b':
-           free_populated_games(games, len);
-#ifdef USE_SHMEM
-           shmdt(shm_dg_data);
-#endif
-          return;
+           goto leavewatchgame;
        case KEY_RIGHT:
        case '.':
             sortmode_increment(watchcols, &sortmode, 1);
@@ -1162,7 +1158,8 @@ inprogressmenu (int gameid)
                  break;
              } else selected = idx;
 watchgame:
-
+             if (!(idx >= 0 && idx < len && games[idx] && games[idx]->name))
+                 goto leavewatchgame;
               /* valid choice has been made */
               chosen_name = strdup (games[idx]->name);
               snprintf (ttyrecname, 130, "%s",
@@ -1236,6 +1233,7 @@ watchgame:
          selectedgame = NULL;
       }
     }
+leavewatchgame:
   free_populated_games(games, len);
 #ifdef USE_SHMEM
   shmdt(shm_dg_data);