Mesh* Sprite3D::getMesh() should return nullptr when _meshes.empty() is true (#16711)

This commit is contained in:
zloopnew 2016-10-27 15:20:41 +08:00 committed by minggo
parent c0e1e91373
commit ed2dac1ba4
2 changed files with 10 additions and 1 deletions

View File

@ -920,6 +920,15 @@ std::vector<Mesh*> Sprite3D::getMeshArrayByName(const std::string& name) const
return meshes;
}
Mesh* Sprite3D::getMesh() const
{
if(_meshes.empty())
{
return nullptr;
}
return _meshes.at(0);
}
MeshSkin* Sprite3D::getSkin() const
{
for (const auto& it : _meshes) {

View File

@ -98,7 +98,7 @@ public:
std::vector<Mesh*> getMeshArrayByName(const std::string& name) const;
/**get mesh*/
Mesh* getMesh() const { return _meshes.at(0); }
Mesh* getMesh() const;
/** get mesh count */
ssize_t getMeshCount() const { return _meshes.size(); }