Skip to content

Commit

Permalink
do not set console mode from an uninitialized variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers authored and madame-rachelle committed Oct 16, 2024
1 parent 3af3b2e commit bf84d81
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/common/platform/win32/i_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,14 @@ int DoMain (HINSTANCE hInstance)

SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);

DWORD mode;

if (SetConsoleMode(StdOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING))
FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting.
if (GetConsoleMode(StdOut, &mode))
{
if (SetConsoleMode(StdOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING))
FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting.
}
}
else if (Args->CheckParm("-stdout") || Args->CheckParm("-norun"))
{
Expand Down

0 comments on commit bf84d81

Please sign in to comment.