From b4e2f2418e7b3bd2e8247fa48d0ba3336eb1d910 Mon Sep 17 00:00:00 2001 From: mattieserver <3049868+mattieserver@users.noreply.github.com> Date: Fri, 16 Sep 2022 16:13:32 +0200 Subject: [PATCH] added extra checks (#166) --- netbox_topology_views/views.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/netbox_topology_views/views.py b/netbox_topology_views/views.py index 457e5ab..cec81f0 100644 --- a/netbox_topology_views/views.py +++ b/netbox_topology_views/views.py @@ -259,14 +259,16 @@ def get_topology_data(queryset, hide_unconnected, save_coords, show_circuit, sho if link.cable.id not in cable_ids: cable_ids[link.cable.id] = {} else: - if cable_ids[link.cable.id]['B'] is not None: - complete_link = True + if 'B' in cable_ids[link.cable.id]: + if cable_ids[link.cable.id]['B'] is not None: + complete_link = True elif link.cable_end == "B": if link.cable.id not in cable_ids: cable_ids[link.cable.id] = {} else: - if cable_ids[link.cable.id]['A'] is not None: - complete_link = True + if 'A' in cable_ids[link.cable.id]: + if cable_ids[link.cable.id]['A'] is not None: + complete_link = True else: print("Unkown cable end") cable_ids[link.cable.id][link.cable_end] = link