cocos2d/cocos2d-x — pull request #1952 by thomaslee (2013-02-04 04:21:38+00:00)
Title: Ensure we don't return invalid texture pointers.

Bug manifested while trying to load a large image via
CCSprite::create(const char *) on a Nexus 7, which only supports
textures up to 2048x2048px.

CCSprite::create(const char *) returned true after failing to load the
large texture even though the underlying CCTexture2D had been released
during CCTexture2D::initWithImage(CCImage *) during the call to
CCTextureCache::addImage(const char *).

Now if CCTexture2D::initWithImage fails, we return NULL from
CCTextureCache::addImage(const char *). This will cause
CCSprite::create(const char *) to return NULL when texture loading
fails, which I believe is the expected/intended behaviour.