浏览代码

Fixed bug with bad index

Fixed a crash that would occur if an incorrect index was passed to
renderNodeName or renderNodeAxes.
Nathan Bowhay 10 年之前
父节点
当前提交
2458ecad9b
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      Engine/source/gui/editor/guiShapeEdPreview.cpp

+ 4 - 0
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 );