From f51fcd90b3f08333fc9c2935cfedfc4c8026a7d9 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Fri, 17 Jan 2014 18:57:52 +0100 Subject: [PATCH] - Fixed scanf in IWAD picker without GTK If you try to kill the program with Ctrl-C, it would run the first IWAD available in the list instead of closing it. --- src/sdl/i_system.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index def35606a..b078e6507 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -684,8 +684,7 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad) printf ("%d. %s (%s)\n", i+1, wads[i].Name.GetChars(), filepart); } printf ("Which one? "); - scanf ("%d", &i); - if (i > numwads) + if (scanf ("%d", &i) != 1 || i > numwads) return -1; return i-1; }