Browse Source

Add nullptr check to fix crashing when using Cast/CollideConvexVsTriangles as standalone utilities

jorrit 3 years ago
parent
commit
310a6ce358
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Jolt/Physics/Collision/NarrowPhaseStats.h

+ 2 - 1
Jolt/Physics/Collision/NarrowPhaseStats.h

@@ -87,7 +87,8 @@ public:
 	{
 	{
 		// Mark time spent in collector as 'child' time for the parent
 		// Mark time spent in collector as 'child' time for the parent
 		uint64 delta_ticks = GetProcessorTickCount() - mStart;
 		uint64 delta_ticks = GetProcessorTickCount() - mStart;
-		TrackNarrowPhaseStat::sRoot->mStat.mChildTicks += delta_ticks;
+		if (TrackNarrowPhaseStat::sRoot != nullptr)
+			TrackNarrowPhaseStat::sRoot->mStat.mChildTicks += delta_ticks;
 
 
 		// Notify all parents of a hit
 		// Notify all parents of a hit
 		for (TrackNarrowPhaseStat *track = TrackNarrowPhaseStat::sRoot; track != nullptr; track = track->mParent)
 		for (TrackNarrowPhaseStat *track = TrackNarrowPhaseStat::sRoot; track != nullptr; track = track->mParent)