Fix getting coordinates

This commit is contained in:
Ben van Hartingsveldt 2025-07-11 16:51:40 +02:00
parent b5650cdbf8
commit d8f2920ac2
3 changed files with 3 additions and 3 deletions

View file

@ -77,7 +77,7 @@ public class BlockchainNodeFinderThread implements Runnable{
Node existingNode = API.NODES.get(node.getKey()); Node existingNode = API.NODES.get(node.getKey());
if(existingNode==null){ if(existingNode==null){
JSONObject geoData = GeoIP.getCachedGeoIPInformation(node.getKey()); JSONObject geoData = GeoIP.getCachedGeoIPInformation(node.getKey());
Double[] coords = GeoIP.getCoordinateFromLocation(geoData.has("loc")?geoData.getString("loc"):null); Double[] coords = GeoIP.getCoordinateFromLocation((geoData!=null && geoData.has("loc"))?geoData.getString("loc"):null);
existingNode = new Node(node.getKey(),coords[0],coords[1]); existingNode = new Node(node.getKey(),coords[0],coords[1]);
API.NODES.put(node.getKey(),existingNode); API.NODES.put(node.getKey(),existingNode);
} }

View file

@ -110,7 +110,7 @@ public class DHTNodeFinderThread implements Runnable{
Node existingNode = API.NODES.get(receiverPacket.getAddress()); Node existingNode = API.NODES.get(receiverPacket.getAddress());
if(existingNode==null){ if(existingNode==null){
JSONObject geoData = GeoIP.getCachedGeoIPInformation(receiverPacket.getAddress()); JSONObject geoData = GeoIP.getCachedGeoIPInformation(receiverPacket.getAddress());
Double[] coords = GeoIP.getCoordinateFromLocation(geoData.has("loc")?geoData.getString("loc"):null); Double[] coords = GeoIP.getCoordinateFromLocation((geoData!=null && geoData.has("loc"))?geoData.getString("loc"):null);
existingNode = new Node(receiverPacket.getAddress(),coords[0],coords[1]); existingNode = new Node(receiverPacket.getAddress(),coords[0],coords[1]);
API.NODES.put(receiverPacket.getAddress(),existingNode); API.NODES.put(receiverPacket.getAddress(),existingNode);
} }

View file

@ -103,7 +103,7 @@ public class HubNodeFinderThread implements Runnable{
Node existingNode = API.NODES.get(entry.getKey()); Node existingNode = API.NODES.get(entry.getKey());
if(existingNode==null){ if(existingNode==null){
JSONObject geoData = GeoIP.getCachedGeoIPInformation(entry.getKey()); JSONObject geoData = GeoIP.getCachedGeoIPInformation(entry.getKey());
Double[] coords = GeoIP.getCoordinateFromLocation(geoData.has("loc")?geoData.getString("loc"):null); Double[] coords = GeoIP.getCoordinateFromLocation((geoData!=null && geoData.has("loc"))?geoData.getString("loc"):null);
existingNode = new Node(entry.getKey(),coords[0],coords[1]); existingNode = new Node(entry.getKey(),coords[0],coords[1]);
API.NODES.put(entry.getKey(),existingNode); API.NODES.put(entry.getKey(),existingNode);
} }