- fixed: SafeCommand did not work anymore because it failed the abuse prevention check for DoCommand.

This commit is contained in:
Christoph Oelckers 2017-03-28 22:34:12 +02:00
parent 224219dd66
commit d5772ff895

View file

@ -132,11 +132,14 @@ class OptionMenuItemCommand : OptionMenuItemSubmenu
override bool Activate() override bool Activate()
{ {
// This needs to perform a few checks to prevent abuse by malicious modders. // This needs to perform a few checks to prevent abuse by malicious modders.
let m = OptionMenu(Menu.GetCurrentMenu()); if (GetClass() != "OptionMenuItemSafeCommand")
// don't execute if no menu is active {
if (m == null) return false; let m = OptionMenu(Menu.GetCurrentMenu());
// don't execute if this item cannot be found in the current menu. // don't execute if no menu is active
if (m.GetItem(mAction) != self) return false; if (m == null) return false;
// don't execute if this item cannot be found in the current menu.
if (m.GetItem(mAction) != self) return false;
}
Menu.MenuSound("menu/choose"); Menu.MenuSound("menu/choose");
DoCommand(mAction); DoCommand(mAction);
return true; return true;