forked from qt-creator/qt-creator
Utils: Do not crash when clicking in empty line of HistoryCompleter
Removing lines from a HistoryCompleter can result in a crash if the mouse click happens on an empty line. Change-Id: I02ee7c4705e1a4bc6b63ccdae207b5078b03360e Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -117,8 +117,11 @@ private:
|
|||||||
if (layoutDirection() == Qt::LeftToRight)
|
if (layoutDirection() == Qt::LeftToRight)
|
||||||
rr = viewport()->width() - event->x();
|
rr = viewport()->width() - event->x();
|
||||||
if (rr < clearButtonSize.width()) {
|
if (rr < clearButtonSize.width()) {
|
||||||
model->removeRow(indexAt(event->pos()).row());
|
const QModelIndex index = indexAt(event->pos());
|
||||||
return;
|
if (index.isValid()) {
|
||||||
|
model->removeRow(indexAt(event->pos()).row());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QListView::mousePressEvent(event);
|
QListView::mousePressEvent(event);
|
||||||
|
Reference in New Issue
Block a user