Skip to content

Commit d8f2920

Browse files
committed
Fix getting coordinates
1 parent b5650cd commit d8f2920

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/com/lbry/globe/thread/BlockchainNodeFinderThread.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void manageBlockchainNodes(JSONArray nodes){
7777
Node existingNode = API.NODES.get(node.getKey());
7878
if(existingNode==null){
7979
JSONObject geoData = GeoIP.getCachedGeoIPInformation(node.getKey());
80-
Double[] coords = GeoIP.getCoordinateFromLocation(geoData.has("loc")?geoData.getString("loc"):null);
80+
Double[] coords = GeoIP.getCoordinateFromLocation((geoData!=null && geoData.has("loc"))?geoData.getString("loc"):null);
8181
existingNode = new Node(node.getKey(),coords[0],coords[1]);
8282
API.NODES.put(node.getKey(),existingNode);
8383
}

src/main/java/com/lbry/globe/thread/DHTNodeFinderThread.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void run(){
110110
Node existingNode = API.NODES.get(receiverPacket.getAddress());
111111
if(existingNode==null){
112112
JSONObject geoData = GeoIP.getCachedGeoIPInformation(receiverPacket.getAddress());
113-
Double[] coords = GeoIP.getCoordinateFromLocation(geoData.has("loc")?geoData.getString("loc"):null);
113+
Double[] coords = GeoIP.getCoordinateFromLocation((geoData!=null && geoData.has("loc"))?geoData.getString("loc"):null);
114114
existingNode = new Node(receiverPacket.getAddress(),coords[0],coords[1]);
115115
API.NODES.put(receiverPacket.getAddress(),existingNode);
116116
}

src/main/java/com/lbry/globe/thread/HubNodeFinderThread.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void run() {
103103
Node existingNode = API.NODES.get(entry.getKey());
104104
if(existingNode==null){
105105
JSONObject geoData = GeoIP.getCachedGeoIPInformation(entry.getKey());
106-
Double[] coords = GeoIP.getCoordinateFromLocation(geoData.has("loc")?geoData.getString("loc"):null);
106+
Double[] coords = GeoIP.getCoordinateFromLocation((geoData!=null && geoData.has("loc"))?geoData.getString("loc"):null);
107107
existingNode = new Node(entry.getKey(),coords[0],coords[1]);
108108
API.NODES.put(entry.getKey(),existingNode);
109109
}

0 commit comments

Comments
 (0)