소스 검색

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

jorrit 3 년 전
부모
커밋
7bf570595b
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  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);