diff --git a/mesh_bot.py b/mesh_bot.py index d857737..d251055 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -225,9 +225,13 @@ def onReceive(packet, interface): hop_away = 0 if packet.get('hopLimit'): hop_limit = packet.get('hopLimit', 0) + else: + hop_limit = 0 if packet.get('hopStart'): hop_start = packet.get('hopStart', 0) + else: + hop_start = 0 if hop_start == hop_limit: hop = "Direct" diff --git a/modules/system.py b/modules/system.py index 7d56483..433ba5f 100644 --- a/modules/system.py +++ b/modules/system.py @@ -185,9 +185,15 @@ def get_node_list(nodeInt=1): logger.warning(f"System: No nodes found") return ERROR_FETCHING_DATA - node_list1.sort(key=lambda x: x[1], reverse=True) - #print (f"Node List: {node_list1[:5]}\n") - node_list2.sort(key=lambda x: x[1], reverse=True) + try: + #print (f"Node List: {node_list1[:5]}\n") + node_list1.sort(key=lambda x: x[1], reverse=True) + #print (f"Node List: {node_list1[:5]}\n") + node_list2.sort(key=lambda x: x[1], reverse=True) + except Exception as e: + logger.error(f"System: Error sorting node list: {e}") + print (f"Node List1: {node_list1[:5]}\n") + print (f"Node List2: {node_list2[:5]}\n") # make a nice list for the user for x in node_list1[:SITREP_NODE_COUNT]: