Merge pull request #10359 from flamefox/3dattachnode

getAttachNode should failed when there is no bone with name
This commit is contained in:
minggo 2015-02-15 19:03:52 +08:00
commit d5e82521de
1 changed files with 7 additions and 4 deletions

View File

@ -578,10 +578,13 @@ AttachNode* Sprite3D::getAttachNode(const std::string& boneName)
if (_skeleton)
{
auto bone = _skeleton->getBoneByName(boneName);
auto attachNode = AttachNode::create(bone);
addChild(attachNode);
_attachments[boneName] = attachNode;
return attachNode;
if (bone)
{
auto attachNode = AttachNode::create(bone);
addChild(attachNode);
_attachments[boneName] = attachNode;
return attachNode;
}
}
return nullptr;