1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Added better error reporting for unclear crashes

This commit is contained in:
Ivan Savenko
2025-01-19 12:39:22 +00:00
parent 711bbc684f
commit 82b81a7853
4 changed files with 25 additions and 5 deletions

View File

@@ -343,6 +343,9 @@ WindowBase::WindowBase(int used_, Point pos_)
void WindowBase::close()
{
if(!GH.windows().isTopWindow(this))
throw std::runtime_error("Only top interface can be closed");
{
auto topWindow = GH.windows().topWindow<IShowActivatable>().get();
throw std::runtime_error(std::string("Only top interface can be closed! Top window is ") + typeid(*this).name() + " but attempted to close " + typeid(*topWindow).name());
}
GH.windows().popWindows(1);
}