Skip to content

Commit 31f9cb4

Browse files
authored
Unchecked Return Value in WIN_SuspendScreenSaver (#12316)
1 parent 057c360 commit 31f9cb4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/video/windows/SDL_windowsvideo.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,15 @@ static void SDLCALL UpdateWindowFrameUsableWhileCursorHidden(void *userdata, con
7676
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
7777
static bool WIN_SuspendScreenSaver(SDL_VideoDevice *_this)
7878
{
79+
DWORD result;
7980
if (_this->suspend_screensaver) {
80-
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
81+
result = SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
8182
} else {
82-
SetThreadExecutionState(ES_CONTINUOUS);
83+
result = SetThreadExecutionState(ES_CONTINUOUS);
84+
}
85+
if (result == 0) {
86+
SDL_SetError("SetThreadExecutionState() failed");
87+
return false;
8388
}
8489
return true;
8590
}

0 commit comments

Comments
 (0)