- 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.
This commit is contained in:
Edoardo Prezioso 2014-01-17 18:57:52 +01:00
parent 2501dc6df6
commit f51fcd90b3

View file

@ -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 ("%d. %s (%s)\n", i+1, wads[i].Name.GetChars(), filepart);
} }
printf ("Which one? "); printf ("Which one? ");
scanf ("%d", &i); if (scanf ("%d", &i) != 1 || i > numwads)
if (i > numwads)
return -1; return -1;
return i-1; return i-1;
} }