From b89bfd44f13c8aaaa5f7d849ed4d20dca2f85641 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 1 Mar 2023 19:28:58 +0100 Subject: [PATCH] Line stats may not exist, even if the line has attributed cost. One scenario for this to happen is when there's children calls data in the symbol. --- server/TracySourceView.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 0cb01e50..2af1a170 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -3558,11 +3558,11 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr if( hw ) PrintHwSampleTooltip( cycles, retired, cacheRef, cacheMiss, branchRetired, branchMiss, false ); - const auto& stats = *worker.GetSymbolStats( symAddrParents ); - if( !stats.parents.empty() ) + const auto stats = worker.GetSymbolStats( symAddrParents ); + if( stats && !stats->parents.empty() ) { ImGui::Separator(); - TextFocused( "Entry call stacks:", RealToString( stats.parents.size() ) ); + TextFocused( "Entry call stacks:", RealToString( stats->parents.size() ) ); ImGui::SameLine(); TextDisabledUnformatted( "(middle click to view)" ); } @@ -3622,7 +3622,7 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr m_asmSampleSelect.clear(); m_asmGroupSelect = -1; } - else if( !stats.parents.empty() && ImGui::IsMouseClicked( 2 ) ) + else if( stats && !stats->parents.empty() && ImGui::IsMouseClicked( 2 ) ) { view.ShowSampleParents( symAddrParents, false ); }