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
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-08-31 07:26:54 +0300
committerCampbell Barton <campbell@blender.org>2022-08-31 07:55:39 +0300
commit065a1cd0b1b12aa371d52de5e5c7b0f634533ff8 (patch)
tree51ed8399b54d385b32f0fab507eba5674978ba28 /intern
parente9d4a20a59a82125f5b84e17b0e9a9a73059152e (diff)
Cleanup: check GetKeyboardState succeeds before using it's values
Quiets compiler warning.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 8b196ca3118..c03d468160a 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1156,10 +1156,10 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
* those events here as well. */
if (!is_repeated_modifier) {
char utf8_char[6] = {0};
- BYTE state[256] = {0};
- GetKeyboardState((PBYTE)state);
- bool ctrl_pressed = state[VK_CONTROL] & 0x80;
- bool alt_pressed = state[VK_MENU] & 0x80;
+ BYTE state[256];
+ const BOOL has_state = GetKeyboardState((PBYTE)state);
+ const bool ctrl_pressed = has_state && state[VK_CONTROL] & 0x80;
+ const bool alt_pressed = has_state && state[VK_MENU] & 0x80;
if (!key_down) {
/* Pass. */