QmlDesigner: Prevent potential nullptr access

Change-Id: Ia11e0968bfc1368e3485a4b5f0d0ea0fa95a7a3f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2016-12-05 14:41:45 +01:00
committed by Tim Jenssen
parent d88ba65a57
commit c4ff03d8b5

View File

@@ -193,15 +193,6 @@ QWidget *DynamicPropertiesDelegate::createEditor(QWidget *parent, const QStyleOp
QWidget *widget = QStyledItemDelegate::createEditor(parent, option, index); QWidget *widget = QStyledItemDelegate::createEditor(parent, option, index);
const DynamicPropertiesModel *model = qobject_cast<const DynamicPropertiesModel*>(index.model()); const DynamicPropertiesModel *model = qobject_cast<const DynamicPropertiesModel*>(index.model());
model->connectionView()->allModelNodes();
// PropertiesComboBox *dynamicPropertiesComboBox = qobject_cast<DynamicPropertiesComboBox*>(widget);
// if (!dynamicPropertiesComboBox) {
// return widget;
// }
if (!model) { if (!model) {
qWarning() << "BindingDelegate::createEditor no model"; qWarning() << "BindingDelegate::createEditor no model";
return widget; return widget;
@@ -211,6 +202,13 @@ QWidget *DynamicPropertiesDelegate::createEditor(QWidget *parent, const QStyleOp
qWarning() << "BindingDelegate::createEditor no connection view"; qWarning() << "BindingDelegate::createEditor no connection view";
return widget; return widget;
} }
model->connectionView()->allModelNodes();
// PropertiesComboBox *dynamicPropertiesComboBox = qobject_cast<DynamicPropertiesComboBox*>(widget);
// if (!dynamicPropertiesComboBox) {
// return widget;
// }
BindingProperty bindingProperty = model->bindingPropertyForRow(index.row()); BindingProperty bindingProperty = model->bindingPropertyForRow(index.row());