Fixed bug with bad index

Fixed a crash that would occur if an incorrect index was passed to
renderNodeName or renderNodeAxes.
This commit is contained in:
Nathan Bowhay 2015-02-02 15:48:05 -08:00
parent f039c98f08
commit 2458ecad9b

View file

@ -1603,6 +1603,8 @@ void GuiShapeEdPreview::renderNodes() const
void GuiShapeEdPreview::renderNodeAxes(S32 index, const ColorF& nodeColor) const
{
if(mModel->mNodeTransforms.size() <= index || index < 0)
return;
const Point3F xAxis( 1.0f, 0.15f, 0.15f );
const Point3F yAxis( 0.15f, 1.0f, 0.15f );
const Point3F zAxis( 0.15f, 0.15f, 1.0f );
@ -1626,6 +1628,8 @@ void GuiShapeEdPreview::renderNodeAxes(S32 index, const ColorF& nodeColor) const
void GuiShapeEdPreview::renderNodeName(S32 index, const ColorF& textColor) const
{
if(index < 0 || index >= mModel->getShape()->nodes.size() || index >= mProjectedNodes.size())
return;
const TSShape::Node& node = mModel->getShape()->nodes[index];
const String& nodeName = mModel->getShape()->getName( node.nameIndex );