Ver código fonte

Return 0 when requesting user data of an invalid sub shape ID

jorrit 3 anos atrás
pai
commit
7bf570595b
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2 0
      Jolt/Physics/Collision/Shape/CompoundShape.cpp

+ 2 - 0
Jolt/Physics/Collision/Shape/CompoundShape.cpp

@@ -132,6 +132,8 @@ uint32 CompoundShape::GetSubShapeUserData(const SubShapeID &inSubShapeID) const
 	// Decode sub shape index
 	SubShapeID remainder;
 	uint32 index = GetSubShapeIndexFromID(inSubShapeID, remainder);
+	if (index >= mSubShapes.size())
+		return 0; // No longer valid index
 
 	// Pass call on
 	return mSubShapes[index].mShape->GetSubShapeUserData(remainder);