ソースを参照

[dnet] Add KeyError check

Add a check for 'inbound' key. Previously, the program would crash when
there were no connected nodes. Now the view panel correctly displays the
existing node as offline.
y 2 年 前
コミット
74b197d008
1 ファイル変更4 行追加0 行削除
  1. 4 0
      bin/dnet/view.py

+ 4 - 0
bin/dnet/view.py

@@ -227,6 +227,10 @@ class View():
                 self.fill_left_box()
                 self.fill_left_box()
                 self.fill_right_box()
                 self.fill_right_box()
 
 
+                # Check that inbound dictionary exists to prevent a KeyError
+                if not 'inbound' in info:
+                    continue
+
                 # If a new inbound comes online, trigger a redraw.
                 # If a new inbound comes online, trigger a redraw.
                 for key in info['inbound'].keys():
                 for key in info['inbound'].keys():
                     if key not in live_inbound:
                     if key not in live_inbound: