QmlProfiler: Don't crash if a statistics entry is empty

In pathological cases we might get event types without any calls.

Change-Id: Id5c9f02c95b60fe49a7cbbac511c3727ade71db0
Task-number: QTCREATORBUG-17885
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2017-03-20 16:18:41 +01:00
parent b1826c2f7f
commit e8a481744d

View File

@@ -638,7 +638,7 @@ void QmlProfilerStatisticsMainView::parseModel()
newRow << new StatisticsViewItem(QString::number(stats.calls), stats.calls);
if (d->m_fieldShown[TimePerCall]) {
const qint64 timePerCall = stats.duration / stats.calls;
const qint64 timePerCall = stats.calls > 0 ? stats.duration / stats.calls : 0;
newRow << new StatisticsViewItem(Timeline::formatTime(timePerCall),
timePerCall);
}