[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [atlas/master] Don't assume that all relays have a country code.



commit 5fd15e08f6632bc54a42d5b895487d9d944f264d
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue Sep 4 08:07:49 2012 -0400

    Don't assume that all relays have a country code.
    
    Without this fix, we'd silently fail when parsing a relay without country
    code and pretend that we're still searching.  There may be more beautiful
    fixes, e.g., displaying a special country flag for "unknown".
---
 js/models/relay.js |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/js/models/relay.js b/js/models/relay.js
index ef884e3..326e378 100644
--- a/js/models/relay.js
+++ b/js/models/relay.js
@@ -141,8 +141,8 @@ define([
                 relay.or_address = relay.or_addresses ? relay.or_addresses[0].split(":")[0] : null;
                 relay.or_port = relay.or_addresses ? relay.or_addresses[0].split(":")[1] : 0;
                 relay.dir_port = relay.dir_address ? relay.dir_address.split(":")[1] : 0;
-                relay.country = relay.country.toLowerCase();
-                relay.countryname = CountryCodes[relay.country];
+                relay.country = relay.country ? relay.country.toLowerCase() : null;
+                relay.countryname = relay.country ? CountryCodes[relay.country] : null;
                 relay.uptime = model.parsedate(relay.last_restarted);
                 relay.uptime_hr = relay.uptime.hr;
                 relay.as_no = relay.as_number;

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits