Skip to content

Commit 076c914

Browse files
committed
Update exception handling in CGUI_Impl::Cleanup
1 parent 748b736 commit 076c914

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Client/gui/CGUI_Impl.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ CGUI_Impl::~CGUI_Impl()
146146

147147
void CGUI_Impl::CreateRootWindow()
148148
{
149+
if (!m_pWindowManager || !m_pSystem)
150+
return;
151+
149152
// Create dummy GUI root
150153
m_pTop = reinterpret_cast<CEGUI::DefaultWindow*>(m_pWindowManager->createWindow("DefaultWindow", "guiroot"));
151154
m_pSystem->setGUISheet(m_pTop);
@@ -1828,8 +1831,14 @@ void CGUI_Impl::Cleanup()
18281831
// Recreate the root window (destroyed above via destroyAllWindows)
18291832
CreateRootWindow();
18301833
}
1831-
catch (std::exception& e)
1834+
catch (const std::exception& e)
18321835
{
18331836
WriteDebugEvent(SString("CGUI_Impl::Cleanup - Exception: %s", e.what()));
1837+
m_pTop = nullptr;
1838+
}
1839+
catch (...)
1840+
{
1841+
WriteDebugEvent("CGUI_Impl::Cleanup() failed with unknown exception");
1842+
m_pTop = nullptr;
18341843
}
18351844
}

0 commit comments

Comments
 (0)