From acc064770c572e982c0b472c4ba02fd9d3f81e75 Mon Sep 17 00:00:00 2001 From: halx99 Date: Tue, 17 Nov 2020 21:57:35 +0800 Subject: [PATCH] fix #263 --- extensions/GUI/CCControlExtension/CCControl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/GUI/CCControlExtension/CCControl.cpp b/extensions/GUI/CCControlExtension/CCControl.cpp index 82cb7bd587..a3edfab5de 100644 --- a/extensions/GUI/CCControlExtension/CCControl.cpp +++ b/extensions/GUI/CCControlExtension/CCControl.cpp @@ -121,7 +121,9 @@ void Control::sendActionsForControlEvents(EventType controlEvents) #if CC_ENABLE_SCRIPT_BINDING cocos2d::BasicScriptData data(this,(void*)&controlEvents); cocos2d::ScriptEvent event(cocos2d::kControlEvent,(void*)&data); - cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(event); + auto scriptEngine = cocos2d::ScriptEngineManager::getInstance()->getScriptEngine(); + if(scriptEngine) + scriptEngine->sendEvent(event); #endif } }