1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-13 20:08:55 +00:00

Fix UnboundLocalError: local variable 'node' referenced before assignment. Fixes #1256.

This commit is contained in:
grossmj 2018-01-14 19:06:35 +07:00
parent 4143ee8178
commit ed275e4ec5

View File

@ -335,11 +335,14 @@ class BaseManager:
:returns: Node instance
"""
node = None
try:
node = yield from self.close_node(node_id)
node = self.get_node(node_id)
yield from self.close_node(node_id)
finally:
node.project.emit("node.deleted", node)
yield from node.project.remove_node(node)
if node:
node.project.emit("node.deleted", node)
yield from node.project.remove_node(node)
if node.id in self._nodes:
del self._nodes[node.id]
return node