do not set console mode from an uninitialized variable.

This commit is contained in:
Christoph Oelckers 2024-10-16 16:54:15 +02:00 committed by Rachael Alexanderson
parent 3af3b2e742
commit bf84d8152b
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0

View file

@ -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"))
{