diff --git a/lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp b/lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp index 7a5d82fb33..edf7c08571 100644 --- a/lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp +++ b/lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp @@ -2007,7 +2007,11 @@ void HdVP2Mesh::_UpdateDrawItem( if (const auto state = drawScene.GetActiveSelectionState(id)) { for (const auto& indexArray : state->instanceIndices) { for (const auto index : indexArray) { - instanceInfo[index] = modeActive; + // This bounds check is necessary because of Pixar USD Issue 1516 + // Logged as MAYA-113682 + if (index >= 0 && index < (const int)instanceCount) { + instanceInfo[index] = modeActive; + } } } } @@ -2016,7 +2020,11 @@ void HdVP2Mesh::_UpdateDrawItem( if (const auto state = drawScene.GetLeadSelectionState(id)) { for (const auto& indexArray : state->instanceIndices) { for (const auto index : indexArray) { - instanceInfo[index] = modeLead; + // This bounds check is necessary because of Pixar USD Issue 1516 + // Logged as MAYA-113682 + if (index >= 0 && index < (const int)instanceCount) { + instanceInfo[index] = modeLead; + } } } }