From 4ed09b18282c18f53f2c1cec512e1ae45cd2d88e Mon Sep 17 00:00:00 2001
From: FutureRave <edoardo.sanguineti222@gmail.com>
Date: Tue, 22 Feb 2022 17:16:12 +0000
Subject: [PATCH] Add check for nullptr in this func as well

---
 src/Components/Modules/Script.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/Components/Modules/Script.cpp b/src/Components/Modules/Script.cpp
index 9bdbae34..42f401d9 100644
--- a/src/Components/Modules/Script.cpp
+++ b/src/Components/Modules/Script.cpp
@@ -747,9 +747,16 @@ namespace Components
 			Script::LastFrameTime = nowMs;
 		});
 
-		Script::AddFunction("debugBox", [](Game::scr_entref_t)
+		Script::AddFunction("DebugBox", [](Game::scr_entref_t)
 		{
-			MessageBoxA(nullptr, Game::Scr_GetString(0), "DEBUG", 0);
+			const auto* message = Game::Scr_GetString(0);
+
+			if (message == nullptr)
+			{
+				Game::Scr_Error("^1DebugBox: Illegal parameter!\n");
+			}
+
+			MessageBoxA(nullptr, message, "DEBUG", MB_OK);
 		}, true);
 
 		Script::AddFunctions();