From 7338b79ef1d8a5625247288057f11d15846a0054 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Wed, 24 May 2017 12:40:45 +0000
Subject: [PATCH] GeoIP: Fix NPE in Maxmind lookup (thx parg!)

---
 router/java/src/net/i2p/router/transport/GeoIP.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/router/java/src/net/i2p/router/transport/GeoIP.java b/router/java/src/net/i2p/router/transport/GeoIP.java
index 23a857a340..8265b5b9c6 100644
--- a/router/java/src/net/i2p/router/transport/GeoIP.java
+++ b/router/java/src/net/i2p/router/transport/GeoIP.java
@@ -208,7 +208,10 @@ public class GeoIP {
                                 // returns upper case or "--"
                                 String uc = ls.getCountryV6(ipv6).getCode();
                                 if (!uc.equals(UNKNOWN_COUNTRY_CODE)) {
-                                    String cached = _codeCache.get(uc.toLowerCase(Locale.US));
+                                    String lc = uc.toLowerCase(Locale.US);
+                                    String cached = _codeCache.get(lc);
+                                    if (cached == null)
+                                        cached = lc;
                                     _IPToCountry.put(search[i], cached);
                                 } else {
                                     _notFound.add(search[i]);
-- 
GitLab