From 5babcbca6b49fda3b4b34c80b1a54e3b251b79a7 Mon Sep 17 00:00:00 2001 From: Walzer Date: Fri, 10 Dec 2010 10:31:14 +0800 Subject: [PATCH] fixed #248, crashed in CCSprite::setDisplayFrame --- cocos2dx/sprite_nodes/CCSprite.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index eea6d8776c..9a82f7c80a 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -917,7 +917,8 @@ void CCSprite::setDisplayFrame(CCSpriteFrame *pNewFrame) CCTexture2D *pNewTexture = pNewFrame->getTexture(); // update texture before updating texture rect - if (pNewTexture->getName() != m_pobTexture->getName()) + if (!m_pobTexture || + pNewTexture->getName() != m_pobTexture->getName()) { setTexture(pNewTexture); }