Commit 07e1f78c authored by Eike Ziller's avatar Eike Ziller

Editors/Function hint: Guard against potential crashes

Change-Id: I285fe66a2ef9fd9543150dbbec5da6a83657ae73
Task-number: QTCREATORBUG-14875
Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent 7a88612a
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment