Skip to content

Commit

Permalink
Merge pull request #2960 from marktucker/dev_getsceneprimpathscrash
Browse files Browse the repository at this point in the history
Fix sizing of result array when calling GetScenePrimPaths with some invalid  instance indices

(Internal change: 2324657)
  • Loading branch information
pixar-oss committed Apr 19, 2024
2 parents f17581b + 732fe33 commit 0be8372
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pxr/usdImaging/usdImaging/instanceAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2662,6 +2662,10 @@ UsdImagingInstanceAdapter::GetScenePrimPaths(
}
}

// Ensure the result vector is the same size as instanceIndices
// even if there are no valid instance indices.
result.resize(instanceIndices.size());

// at least one index was valid, get the prim paths
if (validIndices > 0) {
// For each valid requested index provide a mapping into the result vector
Expand All @@ -2682,7 +2686,6 @@ UsdImagingInstanceAdapter::GetScenePrimPaths(
}
}

result.resize(validIndices);
_GetScenePrimPathsFn primPathsFn(
this, requestedIndicesMap, minIdx, result, proto.path);
_RunForAllInstancesToDraw(instancerPrim, &primPathsFn);
Expand Down

0 comments on commit 0be8372

Please sign in to comment.