From 5429f04614639315b939c80ff99c4b723c82f035 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 16 Sep 2019 15:37:57 +0200 Subject: [PATCH] Don't use source location data before it's ready. --- server/TracyView.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 6edb16c1..9736ea42 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -12182,9 +12182,12 @@ void View::ZoneTooltip( const ZoneEvent& ev ) ImGui::Separator(); TextFocused( "Execution time:", TimeToString( ztime ) ); #ifndef TRACY_NO_STATISTICS - auto& zoneData = m_worker.GetZonesForSourceLocation( ev.SrcLoc() ); - ImGui::SameLine(); - ImGui::TextDisabled( "(%.2f%% of average time)", float( ztime ) / zoneData.total * zoneData.zones.size() * 100 ); + if( m_worker.AreSourceLocationZonesReady() ) + { + auto& zoneData = m_worker.GetZonesForSourceLocation( ev.SrcLoc() ); + ImGui::SameLine(); + ImGui::TextDisabled( "(%.2f%% of average time)", float( ztime ) / zoneData.total * zoneData.zones.size() * 100 ); + } #endif TextFocused( "Self time:", TimeToString( selftime ) ); if( ztime != 0 )