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 } }