From 91a5ecdd7b212a2de72d76cb3dcd8efb64b7d7e6 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Sat, 15 Dec 2018 08:51:01 -0600 Subject: [PATCH] Avoid NPE related carsh in NetworkService when trying to add a very high latency to a malfunctioning node. --- .../java/cy/agorise/graphenej/api/android/NetworkService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java index cb44c48..683b938 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NetworkService.java @@ -710,7 +710,8 @@ public class NetworkService extends Service { // Remove node from nodeLatencyVerifier, so that it publishes its removal nodeLatencyVerifier.removeNode(mSelectedNode); - } else { + // Avoid crash #133 + } else if (mSelectedNode != null){ // Adding a very high latency value to this node in order to prevent // us from getting it again mSelectedNode.addLatencyValue(Long.MAX_VALUE);