Merge pull request #2261 from flaming0/gles20

Null pointer check in order to prevent crashes.
This commit is contained in:
James Chen 2013-03-25 19:11:07 -07:00
commit b9de14c8c7
1 changed files with 8 additions and 0 deletions

View File

@ -159,6 +159,8 @@ int CCLuaEngine::executeSchedule(int nHandler, float dt, CCNode* pNode/* = NULL*
int CCLuaEngine::executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTouch *pTouch)
{
CCTouchScriptHandlerEntry* pScriptHandlerEntry = pLayer->getScriptTouchHandlerEntry();
if (!pScriptHandlerEntry)
return 0;
int nHandler = pScriptHandlerEntry->getHandler();
if (!nHandler) return 0;
@ -193,6 +195,8 @@ int CCLuaEngine::executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTouch
int CCLuaEngine::executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CCSet *pTouches)
{
CCTouchScriptHandlerEntry* pScriptHandlerEntry = pLayer->getScriptTouchHandlerEntry();
if (!pScriptHandlerEntry)
return 0;
int nHandler = pScriptHandlerEntry->getHandler();
if (!nHandler) return 0;
@ -237,6 +241,8 @@ int CCLuaEngine::executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CCSet
int CCLuaEngine::executeLayerKeypadEvent(CCLayer* pLayer, int eventType)
{
CCScriptHandlerEntry* pScriptHandlerEntry = pLayer->getScriptKeypadHandlerEntry();
if (!pScriptHandlerEntry)
return 0;
int nHandler = pScriptHandlerEntry->getHandler();
if (!nHandler) return 0;
@ -259,6 +265,8 @@ int CCLuaEngine::executeLayerKeypadEvent(CCLayer* pLayer, int eventType)
int CCLuaEngine::executeAccelerometerEvent(CCLayer* pLayer, CCAcceleration* pAccelerationValue)
{
CCScriptHandlerEntry* pScriptHandlerEntry = pLayer->getScriptAccelerateHandlerEntry();
if (!pScriptHandlerEntry)
return 0;
int nHandler = pScriptHandlerEntry->getHandler();
if (!nHandler) return 0;