nodeview: use null check
In a perfect world, this would be unnecessary, but it will just save us so many crashes to do it.
This commit is contained in:
@@ -263,6 +263,8 @@ void NodeView::Select(QVector<Node *> nodes)
|
||||
// Remove any duplicates
|
||||
QVector<Node*> processed;
|
||||
|
||||
NodeViewItem *first_item = nullptr;
|
||||
|
||||
foreach (Node* n, nodes) {
|
||||
if (processed.contains(n)) {
|
||||
continue;
|
||||
@@ -272,17 +274,25 @@ void NodeView::Select(QVector<Node *> nodes)
|
||||
|
||||
NodeViewItem* item = scene_.NodeToUIObject(n);
|
||||
|
||||
item->setSelected(true);
|
||||
if (item) {
|
||||
item->setSelected(true);
|
||||
|
||||
if (deselections.contains(n)) {
|
||||
deselections.removeOne(n);
|
||||
} else {
|
||||
new_selections.append(n);
|
||||
if (!first_item) {
|
||||
first_item = item;
|
||||
}
|
||||
|
||||
if (deselections.contains(n)) {
|
||||
deselections.removeOne(n);
|
||||
} else {
|
||||
new_selections.append(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Center on something
|
||||
centerOn(scene_.NodeToUIObject(nodes.first()));
|
||||
if (first_item) {
|
||||
centerOn(first_item);
|
||||
}
|
||||
|
||||
ConnectSelectionChangedSignal();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user