diff options
author | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2012-07-27 14:48:33 +0400 |
---|---|---|
committer | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2012-07-27 14:48:33 +0400 |
commit | 6926e924c0645ab97f41aefebc6b32d5d03fa9c2 (patch) | |
tree | 0570eb263ccb1ccd65f6be5d9e296dc62841ab4c /source/blender/windowmanager/intern/wm_init_exit.c | |
parent | b8d96bc011d255fa06c1327999c199c417c89225 (diff) |
GetStdHandle may return NULL, which isn't really an error, or INVALID_HANDLE_VALUE which does indicate an error, but both should be checked.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_init_exit.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index bd701cbb312..91942a232e1 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -335,14 +335,12 @@ extern void free_fmodifiers_copybuf(void); extern void free_posebuf(void); #if WIN32 -/* read console events until there is a keyboard event, then return */ +/* Read console events until there is a key event. Also returns on any error. */ static void wait_for_console_key(void) { - HANDLE hConsoleInput; + HANDLE hConsoleInput = GetStdHandle(STD_INPUT_HANDLE); - hConsoleInput = GetStdHandle(STD_INPUT_HANDLE); - - if (hConsoleInput && FlushConsoleInputBuffer(hConsoleInput)) { + if (!ELEM(hConsoleInput, NULL, INVALID_HANDLE_VALUE) && FlushConsoleInputBuffer(hConsoleInput)) { for(;;) { INPUT_RECORD buffer; DWORD ignored; |