Fix observed exception

This commit is contained in:
John Lewin 2018-07-18 14:59:36 -07:00
parent 45ff2d5e54
commit 3888cab962

View file

@ -343,7 +343,8 @@ namespace MatterHackers.GCodeVisualizer
for (int i = renderInfo.StartLayerIndex; i < renderInfo.EndLayerIndex - 1; i++)
{
int featuresOnLayer = renderFeatures[i].Count;
if (featuresOnLayer > 1)
if (featuresOnLayer > 1
&& layerVertexBuffer[i] != null)
{
layerVertexBuffer[i].RenderRange(0, featureEndIndex[i][featuresOnLayer - 1]);
}
@ -372,7 +373,8 @@ namespace MatterHackers.GCodeVisualizer
startFeature = Math.Max(endFeature - 1, 0);
}
if (endFeature > startFeature)
if (endFeature > startFeature
&& layerVertexBuffer[layerIndex] != null)
{
int ellementCount = featureEndIndex[layerIndex][endFeature - 1] - featureStartIndex[layerIndex][startFeature];