From: Pasi Kallinen Date: Sun, 18 Oct 2009 17:25:18 +0000 (+0000) Subject: Prevent a segfault when trying to watch a game when none is available. X-Git-Tag: v1.6.1-roc-dev~210 X-Git-Url: https://skyeroc.xyz/gitweb/?a=commitdiff_plain;h=857105e8b2f338cce24adf32379d2f0acc3a6fcd;p=dgamelaunch Prevent a segfault when trying to watch a game when none is available. Also disable '/' when no games available. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@498 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- diff --git a/dgamelaunch.c b/dgamelaunch.c index 0f97f85..95962e9 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -505,6 +505,7 @@ inprogressmenu (int gameid) { int match = -1; char findname[21]; + if (len <= 0) break; findname[0] = '\0'; mvprintw ((btm+2+top_banner_hei), 1, "Watch which player? => "); /* stupid... */ mvaddstr ((btm+2+top_banner_hei), 1, "Watch which player? => "); @@ -566,7 +567,7 @@ inprogressmenu (int gameid) break; default: - if (strchr(selectorchars, menuchoice)) { + if (strchr(selectorchars, menuchoice) && (len > 0)) { int sidx = strchr(selectorchars, menuchoice) - selectorchars; if (sidx > max_height) {