From 2458ecad9b018cfcfce8bbafc3c29581e5574f40 Mon Sep 17 00:00:00 2001 From: Nathan Bowhay Date: Mon, 2 Feb 2015 15:48:05 -0800 Subject: [PATCH] Fixed bug with bad index Fixed a crash that would occur if an incorrect index was passed to renderNodeName or renderNodeAxes. --- Engine/source/gui/editor/guiShapeEdPreview.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 098ff38f3..548634eeb 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -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 );