From 2fc1481202ca6a9989e778594a199d52b9000444 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 20 Oct 2021 08:08:51 +0200 Subject: [PATCH] - validate the newly added menu customizations. --- src/menu/doommenu.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/menu/doommenu.cpp b/src/menu/doommenu.cpp index 7fec2e5fd9..24fb66cfbb 100644 --- a/src/menu/doommenu.cpp +++ b/src/menu/doommenu.cpp @@ -1304,7 +1304,17 @@ void SetDefaultMenuColors() OptionSettings.mFontColorHighlight = V_FindFontColor(gameinfo.mFontColorHighlight); OptionSettings.mFontColorSelection = V_FindFontColor(gameinfo.mFontColorSelection); - auto cls = PClass::FindClass(gameinfo.MenuDelegateClass); + auto cls = PClass::FindClass(gameinfo.HelpMenuClass); + if (!cls) + I_FatalError("%s: Undefined help menu class", gameinfo.HelpMenuClass.GetChars()); + if (!cls->IsDescendantOf(RUNTIME_CLASS(DMenu))) + I_FatalError("'%s' does not inherit from Menu", gameinfo.HelpMenuClass.GetChars()); + + cls = PClass::FindClass(gameinfo.MenuDelegateClass); + if (!cls) + I_FatalError("%s: Undefined menu delegate class", gameinfo.HelpMenuClass.GetChars()); + if (!cls->IsDescendantOf("MenuDelegateBase")) + I_FatalError("'%s' does not inherit from MenuDelegateBase", gameinfo.MenuDelegateClass.GetChars()); menuDelegate = cls->CreateNew(); }