fixed #248, crashed in CCSprite::setDisplayFrame

This commit is contained in:
Walzer 2010-12-10 10:31:14 +08:00
parent f3126de646
commit 5babcbca6b
1 changed files with 2 additions and 1 deletions

View File

@ -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);
}