Ensure valid values in watching

This commit is contained in:
Pasi Kallinen 2012-03-17 12:17:02 +02:00
parent 3ef04ef269
commit 7c0741110e
2 changed files with 6 additions and 6 deletions

2
TODO
View File

@ -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.

View 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);