From 93344e942731f5b82a2ce3ad91b4ce7bf920222e Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 31 Mar 2015 22:00:05 +0200 Subject: [PATCH] Fix crash when NIO doesn't exist Fix #122 --- gns3server/modules/iou/iou_vm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gns3server/modules/iou/iou_vm.py b/gns3server/modules/iou/iou_vm.py index 7e2a9b19..e1faa345 100644 --- a/gns3server/modules/iou/iou_vm.py +++ b/gns3server/modules/iou/iou_vm.py @@ -1012,6 +1012,10 @@ class IOUVM(BaseVM): port_number=port_number)) nio = adapter.get_nio(port_number) + if not nio: + raise IOUError("NIO {port_number} doesn't exist in adapter {adapter}".format(adapter=adapter, + port_number=port_number)) + if nio.capturing: raise IOUError("Packet capture is already activated on {adapter_number}/{port_number}".format(adapter_number=adapter_number, port_number=port_number))