From 83ab1d09ae23d70592d3d5adaa1f22992d4f4f22 Mon Sep 17 00:00:00 2001
From: str4d <str4d@mail.i2p>
Date: Mon, 18 Nov 2013 06:29:07 +0000
Subject: [PATCH] Don't crash if RI or LS lookup returns null

Todo: determine why some lookups of OBEPs can be null, and handle the null case
in the UI.
---
 .../i2p/android/router/fragment/NetDbDetailFragment.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/net/i2p/android/router/fragment/NetDbDetailFragment.java b/src/net/i2p/android/router/fragment/NetDbDetailFragment.java
index a84863868..0b0920c0d 100644
--- a/src/net/i2p/android/router/fragment/NetDbDetailFragment.java
+++ b/src/net/i2p/android/router/fragment/NetDbDetailFragment.java
@@ -83,11 +83,15 @@ public class NetDbDetailFragment extends I2PFragmentBase {
                 if (getArguments().getBoolean(IS_RI)) {
                     // Load RouterInfo
                     RouterInfo ri = getNetDb().lookupRouterInfoLocally(hash);
-                    loadRouterInfo(ri);
+                    if (ri != null)
+                        loadRouterInfo(ri);
+                    // TODO: Handle null case in UI
                 } else {
                     // Load LeaseSet
                     LeaseSet ls = getNetDb().lookupLeaseSetLocally(hash);
-                    loadLeaseSet(ls);
+                    if (ls != null)
+                        loadLeaseSet(ls);
+                    // TODO: Handle null case in UI
                 }
             } catch (DataFormatException e) {
                 Util.e(e.toString());
-- 
GitLab