From d5772ff8955efd5af76c45292c5a967a8658d1a6 Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <coelckers@users.noreply.github.com>
Date: Tue, 28 Mar 2017 22:34:12 +0200
Subject: [PATCH] - fixed: SafeCommand did not work anymore because it failed
 the abuse prevention check for DoCommand.

---
 wadsrc/static/zscript/menu/optionmenuitems.txt | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/wadsrc/static/zscript/menu/optionmenuitems.txt b/wadsrc/static/zscript/menu/optionmenuitems.txt
index 2bbb4a82b..01771a372 100644
--- a/wadsrc/static/zscript/menu/optionmenuitems.txt
+++ b/wadsrc/static/zscript/menu/optionmenuitems.txt
@@ -132,11 +132,14 @@ class OptionMenuItemCommand : OptionMenuItemSubmenu
 	override bool Activate()
 	{
 		// This needs to perform a few checks to prevent abuse  by malicious modders.
-		let m = OptionMenu(Menu.GetCurrentMenu());
-		// don't execute if no menu is active
-		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;
+		if (GetClass() != "OptionMenuItemSafeCommand")
+		{
+			let m = OptionMenu(Menu.GetCurrentMenu());
+			// don't execute if no menu is active
+			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");
 		DoCommand(mAction);
 		return true;