Skip to content

Commit

Permalink
- clear menuDelegate in case of an error in MENUDEF parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Jan 20, 2023
1 parent acfca3f commit a570e77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions source/common/menu/menu.cpp
Expand Up @@ -924,10 +924,16 @@ void M_Init (void)
}
catch (CVMAbortException &err)
{
menuDelegate = nullptr;
err.MaybePrintMessage();
Printf(PRINT_NONOTIFY | PRINT_BOLD, "%s", err.stacktrace.GetChars());
I_FatalError("Failed to initialize menus");
}
catch (...)
{
menuDelegate = nullptr;
throw;
}
M_CreateMenus();
}

Expand Down
4 changes: 2 additions & 2 deletions source/common/menu/menudef.cpp
Expand Up @@ -150,13 +150,13 @@ void DeinitMenus()
pair->Value = nullptr;
}
}
MenuDescriptors.Clear();
OptionValues.Clear();
if (menuDelegate)
{
menuDelegate->Destroy();
menuDelegate = nullptr;
}
MenuDescriptors.Clear();
OptionValues.Clear();
}

FTextureID GetMenuTexture(const char* const name)
Expand Down

0 comments on commit a570e77

Please sign in to comment.