Only reopen the streams if AllocConsole succeeds.

Avoid a crash with FGRun when OSG tries to use the console.
This commit is contained in:
James Turner
2016-09-02 00:05:13 +01:00
parent c1ba974538
commit 9b997ea1f7

View File

@@ -232,13 +232,11 @@ public:
if (AttachConsole(ATTACH_PARENT_PROCESS) == 0) {
// attach failed, don't install the callback
addStderr = false;
}
if (!isFile) {
// No - OK! now set streams to attached console
freopen("conout$", "w", stdout);
freopen("conout$", "w", stderr);
}
} else if (!isFile) {
// No - OK! now set streams to attached console
freopen("conout$", "w", stdout);
freopen("conout$", "w", stderr);
}
#endif
if (addStderr) {
m_callbacks.push_back(new StderrLogCallback(m_logClass, m_logPriority));