Make sure we don't index past the end of the array

This commit is contained in:
Lars Brubaker 2019-05-24 17:35:18 -07:00
parent 8c98cfb8ab
commit 409c9c8a88
2 changed files with 3 additions and 2 deletions

View file

@ -342,7 +342,8 @@ namespace MatterHackers.GCodeVisualizer
for (int i = renderInfo.EndLayerIndex - 1; i >= renderInfo.StartLayerIndex; i--)
{
// If its the first render or we change what we are trying to render then create vertex data.
if (layerVertexBuffer[i] == null)
if (layerVertexBuffer.Count > i
&& layerVertexBuffer[i] == null)
{
layerVertexBuffer[i] = Create3DDataForLayer(i, renderInfo);
}