Commit fb137ade authored by Giuseppe D'Angelo's avatar Giuseppe D'Angelo

Fix crash in VariableChooser

fce83bd9f84883f93829e6ca9eacf098b018a02d in qtbase causes a crash:
setModel creates a new selection model, which calls currentChanged,
which accesses an uninitialized member. Hence, protect the access to it.

Change-Id: I144f40aa4286f1a9edba24519a30c08ff5091f57
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent 0fda5b63
......@@ -245,7 +245,10 @@ VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent)
: q(parent),
m_lineEdit(0),
m_textEdit(0),
m_plainTextEdit(0)
m_plainTextEdit(0),
m_iconButton(0),
m_variableTree(0),
m_variableDescription(0)
{
m_defaultDescription = VariableChooser::tr("Select a variable to insert.");
......@@ -408,7 +411,8 @@ void VariableChooser::addSupportForChildWidgets(QWidget *parent, MacroExpander *
*/
void VariableChooserPrivate::updateDescription(const QModelIndex &index)
{
m_variableDescription->setText(m_model.data(index, Qt::ToolTipRole).toString());
if (m_variableDescription)
m_variableDescription->setText(m_model.data(index, Qt::ToolTipRole).toString());
}
/*!
......
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