From 9ed7f1e85a2a6661fa82e1658e09a3df6d047c64 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 17 Oct 2019 23:56:22 -0400 Subject: [PATCH] Fix crash if any built-in scripts try to use the interface api We don't have any scripts like this and never will. But if we did, this would fix the crash. --- src/gui/game/GameController.cpp | 1 - src/lua/LuaScriptInterface.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index feb530eac..f13c7e95a 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -191,7 +191,6 @@ GameController::GameController(): #ifdef LUACONSOLE commandInterface = new LuaScriptInterface(this, gameModel); - ((LuaScriptInterface*)commandInterface)->SetWindow(gameView); #else commandInterface = new TPTScriptInterface(this, gameModel); #endif diff --git a/src/lua/LuaScriptInterface.cpp b/src/lua/LuaScriptInterface.cpp index 022a48040..365aee26d 100644 --- a/src/lua/LuaScriptInterface.cpp +++ b/src/lua/LuaScriptInterface.cpp @@ -144,6 +144,7 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m): initSimulationAPI(); initInterfaceAPI(); + SetWindow(c->GetView()); initRendererAPI(); initElementsAPI(); initGraphicsAPI();