Merge pull request #12748 from fusijie/refineSetTexture

refine setTexture.
This commit is contained in:
pandamicro 2015-07-09 14:56:06 +08:00
commit cab670f0ff
1 changed files with 1 additions and 1 deletions

View File

@ -343,7 +343,7 @@ void Sprite::setTexture(const std::string &filename)
void Sprite::setTexture(Texture2D *texture)
{
// If batchnode, then texture id should be the same
CCASSERT(! _batchNode || texture->getName() == _batchNode->getTexture()->getName(), "CCSprite: Batched sprites should use the same texture as the batchnode");
CCASSERT(! _batchNode || (texture && texture->getName() == _batchNode->getTexture()->getName()), "CCSprite: Batched sprites should use the same texture as the batchnode");
// accept texture==nil as argument
CCASSERT( !texture || dynamic_cast<Texture2D*>(texture), "setTexture expects a Texture2D. Invalid argument");