From 7215f852b8b591d20b4eaab39fbb8582ad46557e Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Tue, 23 Jun 2020 13:34:40 -0700 Subject: [PATCH] grpc: added check for emane pathloss when nem id is None and throw an error --- daemon/core/api/grpc/grpcutils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/daemon/core/api/grpc/grpcutils.py b/daemon/core/api/grpc/grpcutils.py index b63cb895..8df545cd 100644 --- a/daemon/core/api/grpc/grpcutils.py +++ b/daemon/core/api/grpc/grpcutils.py @@ -487,4 +487,8 @@ def get_nem_id(node: CoreNode, iface_id: int, context: ServicerContext) -> int: if not isinstance(net, EmaneNet): message = f"{node.name} interface {iface_id} is not an EMANE network" context.abort(grpc.StatusCode.INVALID_ARGUMENT, message) - return net.getnemid(iface) + nem_id = net.getnemid(iface) + if nem_id is None: + message = f"{node.name} interface {iface_id} nem id does not exist" + context.abort(grpc.StatusCode.INVALID_ARGUMENT, message) + return nem_id