From dfff43f917d8e6e99f0d8d0cf117dbd23d0f0da6 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Fri, 19 Jul 2019 10:56:05 +0300 Subject: [PATCH] Added null check to GeolocationCache - Checks against null country name Affects issues: - Close #1101 --- .../com/djrapitops/plan/system/cache/GeolocationCache.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java b/Plan/common/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java index f97c71d79..9f26e20f6 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java @@ -162,8 +162,9 @@ public class GeolocationCache implements SubSystem { CountryResponse response = reader.country(inetAddress); Country country = response.getCountry(); + String countryName = country.getName(); - return country.getName(); + return countryName != null ? countryName : "Not Known"; } } catch (IOException | GeoIp2Exception e) {