diff --git a/src/net.c b/src/net.c
index 2565be11..58db16e2 100644
--- a/src/net.c
+++ b/src/net.c
@@ -113,7 +113,7 @@ void terminate_connection(connection_t *c, bool report) {
 
 	c->status.active = false;
 
-	if(c->node)
+	if(c->node && c->node->connection == c)
 		c->node->connection = NULL;
 
 	if(c->edge) {