Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wilkins <Jason.A.Wilkins@gmail.com>2012-07-27 14:48:33 +0400
committerJason Wilkins <Jason.A.Wilkins@gmail.com>2012-07-27 14:48:33 +0400
commit6926e924c0645ab97f41aefebc6b32d5d03fa9c2 (patch)
tree0570eb263ccb1ccd65f6be5d9e296dc62841ab4c /source/blender/windowmanager/intern/wm_init_exit.c
parentb8d96bc011d255fa06c1327999c199c417c89225 (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.c8
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;