Narendrabrsoft / cocos2d-android-1

Automatically exported from code.google.com/p/cocos2d-android-1
0 stars 0 forks source link

Crash when calling CCSpriteSheet::removeChild #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. remove a sprite from a CCSpriteSheet

What version of the product are you using? On what operating system?
most recent master branch

Crash occures in
public void removeSpriteFromAtlas(CCSprite sprite) 
{
.....
for(CCNode o : sprite.getChildren())  <----
{
        removeSpriteFromAtlas((CCSprite)o);
}
....
}

Crashes if sprite.getChildren() returns null.

Fix: 

check for null pointer, e.g:

if (sprite.getChildren() != null)
{
        for(CCNode o : sprite.getChildren()) 
        {
            removeSpriteFromAtlas((CCSprite)o);
        }
}

Original issue reported on code.google.com by oonneett...@gmail.com on 15 Dec 2010 at 9:23