From 3a8ffebc28f8f67acb5141f64424792f7d177f7a Mon Sep 17 00:00:00 2001 From: "Erwin Coumans (Google)" Date: Mon, 18 Apr 2016 21:43:42 -0700 Subject: [PATCH] fix possible division-by-zero if the profiler gui is called before stepSimulation is proceeding. --- examples/ExampleBrowser/GwenGUISupport/GwenProfileWindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/ExampleBrowser/GwenGUISupport/GwenProfileWindow.cpp b/examples/ExampleBrowser/GwenGUISupport/GwenProfileWindow.cpp index b10db3ef0..d376246ec 100644 --- a/examples/ExampleBrowser/GwenGUISupport/GwenProfileWindow.cpp +++ b/examples/ExampleBrowser/GwenGUISupport/GwenProfileWindow.cpp @@ -93,7 +93,9 @@ public: float accumulated_time=0,parent_time = profileIterator->Is_Root() ? CProfileManager::Get_Time_Since_Reset() : profileIterator->Get_Current_Parent_Total_Time(); int i; int frames_since_reset = CProfileManager::Get_Frame_Count_Since_Reset(); - + if (0==frames_since_reset) + return 0.f; + //printf("Profiling: %s (total running time: %.3f ms) ---\n", profileIterator->Get_Current_Parent_Name(), parent_time ); float totalTime = 0.f;