forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user