Skip to content

Commit d4b8395

Browse files
sindneypaceholder
authored andcommitted
Fix dereferencing nullptr (paceholder#194)
Dereferencing nullptr node causes crash on osx’s clang.
1 parent 47a1c35 commit d4b8395

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/ConnectionGraphicsObject.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,15 @@ mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
207207
auto node = locateNodeAt(event->scenePos(), _scene,
208208
_scene.views()[0]->transform());
209209

210-
NodeConnectionInteraction interaction(*node, _connection, _scene);
211-
212-
if (node && interaction.tryConnect())
213-
{
214-
node->resetReactionToConnection();
210+
if (node) {
211+
NodeConnectionInteraction interaction(*node, _connection, _scene);
212+
if (interaction.tryConnect()) {
213+
node->resetReactionToConnection();
214+
return;
215+
}
215216
}
216-
else if (_connection.connectionState().requiresPort())
217+
218+
if (_connection.connectionState().requiresPort())
217219
{
218220
_scene.deleteConnection(_connection);
219221
}

0 commit comments

Comments
 (0)