From 357ac458349466e945dd7a194a5b6cc98c80cce6 Mon Sep 17 00:00:00 2001 From: Victor Zarubkin Date: Tue, 29 Oct 2019 23:48:17 +0300 Subject: [PATCH] [ui] fixed zero division error --- profiler_gui/graphics_scrollbar.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/profiler_gui/graphics_scrollbar.cpp b/profiler_gui/graphics_scrollbar.cpp index eb3e639..acd068e 100644 --- a/profiler_gui/graphics_scrollbar.cpp +++ b/profiler_gui/graphics_scrollbar.cpp @@ -835,8 +835,11 @@ void GraphicsHistogramItem::setSource(profiler::thread_id_t _thread_id, profiler } } - m_avgDuration = m_blockTotalDuraion / totalCount; - m_medianDuration = profiler_gui::calculateMedian(durations); + if (totalCount != 0) + { + m_avgDuration = m_blockTotalDuraion / totalCount; + m_medianDuration = profiler_gui::calculateMedian(durations); + } m_medianDurationFull = m_medianDuration; m_avgDurationFull = m_avgDuration; @@ -1528,7 +1531,7 @@ void GraphicsHistogramItem::updateImageAsync(QRectF _boundingRect, HistRegime _r m_workerTopDuration = _top_duration; m_workerBottomDuration = _bottom_duration; - if (_bindMode) + if (_bindMode && totalCount != 0) { m_workerAvgDuration /= totalCount; m_workerMedianDuration = profiler_gui::calculateMedian(durations);