aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libwinmain/winmain.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libwinmain/winmain.c b/libwinmain/winmain.c
index 4e5886397..a4ffc1102 100644
--- a/libwinmain/winmain.c
+++ b/libwinmain/winmain.c
@@ -44,6 +44,8 @@ static void CreateConsole(void)
// redirect unbuffered STDOUT to the console
lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
+ if (hConHandle==-1) // error occured, so return
+ return;
fp = _fdopen( hConHandle, "w" );
*stdout = *fp;
setvbuf( stdout, NULL, _IONBF, 0 );