From 31455929011ffd2d463afcd4e1443c887e3f4a70 Mon Sep 17 00:00:00 2001 From: Jay Shrauner Date: Wed, 2 Jul 2014 09:48:31 -0700 Subject: Fix NPE in isEncodedContactUri Check for null return from getLastPathSegment Bug:16034483 Change-Id: Ide3cd794bb7702465814c86b1eb406242eba9149 --- src/com/android/contacts/common/util/UriUtils.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/com/android/contacts/common/util/UriUtils.java b/src/com/android/contacts/common/util/UriUtils.java index dbe900b5..f8c5aa11 100644 --- a/src/com/android/contacts/common/util/UriUtils.java +++ b/src/com/android/contacts/common/util/UriUtils.java @@ -50,6 +50,13 @@ public class UriUtils { } public static boolean isEncodedContactUri(Uri uri) { - return uri != null && uri.getLastPathSegment().equals(Constants.LOOKUP_URI_ENCODED); + if (uri == null) { + return false; + } + final String lastPathSegment = uri.getLastPathSegment(); + if (lastPathSegment == null) { + return false; + } + return lastPathSegment.equals(Constants.LOOKUP_URI_ENCODED); } } -- cgit v1.2.3