Skip to content

Commit 171eb3c

Browse files
authored
PropertyTree: set custom SelectionModel only with valid model (#1504)
1 parent 60f2998 commit 171eb3c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/rviz/properties/property_tree_widget.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ void PropertyTreeWidget::setModel(PropertyTreeModel* model)
103103
}
104104
model_ = model;
105105
QTreeView::setModel(model_);
106-
QItemSelectionModel* m = selectionModel();
107-
setSelectionModel(new PropertySelectionModel(model_));
108-
m->deleteLater();
109106
if (model_)
110107
{
108+
QItemSelectionModel* m = selectionModel();
109+
setSelectionModel(new PropertySelectionModel(model_));
110+
m->deleteLater();
111+
111112
connect(model_, SIGNAL(propertyHiddenChanged(const Property*)), this,
112113
SLOT(propertyHiddenChanged(const Property*)), Qt::QueuedConnection);
113114
connect(model_, SIGNAL(expand(const QModelIndex&)), this, SLOT(expand(const QModelIndex&)));

0 commit comments

Comments
 (0)