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
|
// Remove any duplicates
|
||||||
QVector<Node*> processed;
|
QVector<Node*> processed;
|
||||||
|
|
||||||
|
NodeViewItem *first_item = nullptr;
|
||||||
|
|
||||||
foreach (Node* n, nodes) {
|
foreach (Node* n, nodes) {
|
||||||
if (processed.contains(n)) {
|
if (processed.contains(n)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -272,17 +274,25 @@ void NodeView::Select(QVector<Node *> nodes)
|
|||||||
|
|
||||||
NodeViewItem* item = scene_.NodeToUIObject(n);
|
NodeViewItem* item = scene_.NodeToUIObject(n);
|
||||||
|
|
||||||
item->setSelected(true);
|
if (item) {
|
||||||
|
item->setSelected(true);
|
||||||
|
|
||||||
if (deselections.contains(n)) {
|
if (!first_item) {
|
||||||
deselections.removeOne(n);
|
first_item = item;
|
||||||
} else {
|
}
|
||||||
new_selections.append(n);
|
|
||||||
|
if (deselections.contains(n)) {
|
||||||
|
deselections.removeOne(n);
|
||||||
|
} else {
|
||||||
|
new_selections.append(n);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center on something
|
// Center on something
|
||||||
centerOn(scene_.NodeToUIObject(nodes.first()));
|
if (first_item) {
|
||||||
|
centerOn(first_item);
|
||||||
|
}
|
||||||
|
|
||||||
ConnectSelectionChangedSignal();
|
ConnectSelectionChangedSignal();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user