From e2e8325f58a629372a8fab29ba469687a77587da Mon Sep 17 00:00:00 2001 From: andyque Date: Wed, 6 Aug 2014 13:51:16 +0800 Subject: [PATCH] add safe guard when remove component from node componentContainer --- cocos/2d/CCNode.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index f90c87b8e5..604a201785 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -1852,7 +1852,10 @@ bool Node::removeComponent(const std::string& name) bool Node::removeComponent(Component *component) { - return _componentContainer->remove(component); + if (_componentContainer) { + return _componentContainer->remove(component); + } + return false; } void Node::removeAllComponents()