From 4ff321d50773166712a611233437c7b19183087c Mon Sep 17 00:00:00 2001 From: Kester Maddock Date: Fri, 4 Jun 2004 02:10:58 +0000 Subject: Fix bug #1334: Crash with Python/GameEngine when the script has syntax errors. When Python compile fails (eg syntax errors) skip the execute stage. --- source/gameengine/GameLogic/SCA_PythonController.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/gameengine/GameLogic/SCA_PythonController.cpp') diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index c9ecb412035..2517870eb19 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -223,14 +223,14 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) if (m_bytecode) { // store the - int i=0; - i+=2; // so compiler doesn't complain about unused variable PyRun_SimpleString("import GameLogic\n"); } else { // didn't compile, so instead of compile, complain - int i=0; - i++; // so compiler doesn't complain about unused variable + // something is wrong, tell the user what went wrong + printf("PYTHON SCRIPT ERROR:\n"); + PyRun_SimpleString(m_scriptText.Ptr()); + return; } m_bModified=false; } -- cgit v1.2.3