Editors/Function hint: Guard against potential crashes

Change-Id: I285fe66a2ef9fd9543150dbbec5da6a83657ae73
Task-number: QTCREATORBUG-14875
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Eike Ziller
2015-08-07 09:13:55 +02:00
parent 7a88612a8e
commit 07e1f78ca8

View File

@@ -34,6 +34,7 @@
#include <utils/faketooltip.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QDebug>
#include <QApplication>
@@ -201,7 +202,8 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e)
d->m_escapePressed = true;
e->accept();
}
if (d->m_model->size() > 1) {
QTC_CHECK(d->m_model);
if (d->m_model && d->m_model->size() > 1) {
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
if (ke->key() == Qt::Key_Up) {
previousPage();
@@ -220,10 +222,13 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e)
emit explicitlyAborted();
return false;
} else if (ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Down) {
if (d->m_model->size() > 1)
QTC_CHECK(d->m_model);
if (d->m_model && d->m_model->size() > 1)
return false;
}
d->m_assistant->notifyChange();
QTC_CHECK(d->m_assistant);
if (d->m_assistant)
d->m_assistant->notifyChange();
}
break;
case QEvent::WindowDeactivate: