فهرست منبع

dnet: check inbound/outbound/manual/seed exists to prevent KeyErrors

lunar-mining 2 سال پیش
والد
کامیت
9c9a101996
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      bin/dnet/view.py

+ 4 - 4
bin/dnet/view.py

@@ -94,7 +94,7 @@ class View():
        node.set_txt()
        self.listwalker.contents.append(node)
 
-       if info['outbound']:
+       if 'outbound' in info and info['outbound']:
            session = Session(node_name, "outbound")
            session.set_txt()
            self.listwalker.contents.append(session)
@@ -103,7 +103,7 @@ class View():
                slot.set_txt(i, addr)
                self.listwalker.contents.append(slot)
 
-       if info['inbound']:
+       if 'inbound' in info and info['inbound']:
            if any(info['inbound'].values()):
                session = Session(node_name, "inbound")
                session.set_txt()
@@ -114,7 +114,7 @@ class View():
                        slot.set_txt(i, addr)
                        self.listwalker.contents.append(slot)
 
-       if info['manual']:
+       if 'manual' in info and info['manual']:
            session = Session(node_name, "manual")
            session.set_txt()
            self.listwalker.contents.append(session)
@@ -123,7 +123,7 @@ class View():
                slot.set_txt(i, addr)
                self.listwalker.contents.append(slot)
 
-       if info['seed']:
+       if 'seed' in info and info['seed']:
            session = Session(node_name, "seed")
            session.set_txt()
            self.listwalker.contents.append(session)