[tor-commits] [torbel/master] 4500 - check TorCtl.get_router return value
sebastian at torproject.org
sebastian at torproject.org
Thu Nov 17 18:15:16 UTC 2011
commit a0a63388e36c5384e4730e48555474fdf4566d72
Author: aagbsn <aagbsn at extc.org>
Date: Thu Nov 17 07:55:37 2011 -0800
4500 - check TorCtl.get_router return value
TorCtl.get_router can return None if no descriptor is found; added
a test before using.
---
controller.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/controller.py b/controller.py
index fe6dbf7..7bef189 100644
--- a/controller.py
+++ b/controller.py
@@ -647,10 +647,11 @@ class Controller(TorCtl.EventHandler):
try:
ns = self.conn.get_network_status("id/" + rid)[0]
router = self.conn.get_router(ns)
- self.add_to_cache(router)
- # Notify scheduler that a new router is available for testing.
- if self.scheduler:
- self.scheduler.new_descriptor(router)
+ if router:
+ self.add_to_cache(router)
+ # Notify scheduler that a new router is available for testing.
+ if self.scheduler:
+ self.scheduler.new_descriptor(router)
except TorCtl.ErrorReply, e:
log.error("NEWDESC: Controller error: %s", str(e))
More information about the tor-commits
mailing list