From 0ff6d6364b18b1b48a3ee05f982e3a5f85b74c4b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 28 Dec 2019 18:03:13 +0100 Subject: [PATCH] Don't operate on empty vector. --- server/TracyView.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 4d81efcf..719a323d 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -8392,15 +8392,18 @@ void View::DrawFindZone() } } } - auto mid = vec.begin() + m_findZone.selSortActive; - pdqsort_branchless( mid, vec.end() ); - std::inplace_merge( vec.begin(), mid, vec.end() ); + if( !vec.empty() ) + { + auto mid = vec.begin() + m_findZone.selSortActive; + pdqsort_branchless( mid, vec.end() ); + std::inplace_merge( vec.begin(), mid, vec.end() ); - m_findZone.selAverage = float( total ) / act; - m_findZone.selMedian = vec[act/2]; - m_findZone.selTotal = total; - m_findZone.selSortNum = m_findZone.sortedNum; - m_findZone.selSortActive = act; + m_findZone.selAverage = float( total ) / act; + m_findZone.selMedian = vec[act/2]; + m_findZone.selTotal = total; + m_findZone.selSortNum = m_findZone.sortedNum; + m_findZone.selSortActive = act; + } } }