Commit 16e18817e909f019628cbdf3a2b55204eaee03d2

Philipp Wiesemann 2015-07-16T21:31:21

Windows: Fixed wrong debugger output if logging empty string as info or warning.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/SDL_log.c b/src/SDL_log.c
index 0261f12..b5ab601 100644
--- a/src/SDL_log.c
+++ b/src/SDL_log.c
@@ -371,9 +371,9 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
         if (consoleAttached == 1) {
                 if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) {
                     OutputDebugString(TEXT("Error calling WriteConsole\r\n"));
-                }
-                if (charsWritten == ERROR_NOT_ENOUGH_MEMORY) {
-                    OutputDebugString(TEXT("Insufficient heap memory to write message\r\n"));
+                    if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) {
+                        OutputDebugString(TEXT("Insufficient heap memory to write message\r\n"));
+                    }
                 }
         }
 #endif /* ifndef __WINRT__ */