summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2013-07-01 16:53:31 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-07-01 16:53:31 +0000
commit8f5e3d13e166e4873e130a5ef7c987333dbac917 (patch)
treebd453c23d640db2ad83413bb06d5a1b46aeaa5e0
parent54d499f6db7b7fa42543cae98b001f790c8df70b (diff)
parent8ed09e893f6a4b6a4f6503186515b8f6978baa14 (diff)
downloadframeworks_base-8f5e3d13e166e4873e130a5ef7c987333dbac917.zip
frameworks_base-8f5e3d13e166e4873e130a5ef7c987333dbac917.tar.gz
frameworks_base-8f5e3d13e166e4873e130a5ef7c987333dbac917.tar.bz2
Merge "Fix an NPE in NsdManager"
-rw-r--r--services/java/com/android/server/NsdService.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/services/java/com/android/server/NsdService.java b/services/java/com/android/server/NsdService.java
index faa72a2..e0f415b 100644
--- a/services/java/com/android/server/NsdService.java
+++ b/services/java/com/android/server/NsdService.java
@@ -417,7 +417,15 @@ public class NsdService extends INsdManager.Stub {
int keyId = clientInfo.mClientIds.indexOfValue(id);
if (keyId != -1) {
clientId = clientInfo.mClientIds.keyAt(keyId);
+ } else {
+ // This can happen because of race conditions. For example,
+ // SERVICE_FOUND may race with STOP_SERVICE_DISCOVERY,
+ // and we may get in this situation.
+ Slog.d(TAG, "Notification for a listener that is no longer active: " + id);
+ handled = false;
+ return handled;
}
+
switch (code) {
case NativeResponseCode.SERVICE_FOUND:
/* NNN uniqueId serviceName regType domain */