From b1bf9a2a0cd929130ee75a29b5f7a9f01901a0d7 Mon Sep 17 00:00:00 2001 From: Mattias Falk Date: Thu, 3 Jan 2013 12:49:09 +0100 Subject: Avoid NullPointerException A crash will occur when a user share more than one file and the mime type of any of the files to share is null. Avoid crash by not adding the mime type to the mime type list if the value is null. Change-Id: Ia06f3389da6ce34e11ffcf349a10fdbe64cfc9bd --- ui/src/com/android/providers/downloads/ui/DownloadList.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/src/com/android/providers/downloads/ui/DownloadList.java b/ui/src/com/android/providers/downloads/ui/DownloadList.java index 29ea60eb..db86ab7e 100644 --- a/ui/src/com/android/providers/downloads/ui/DownloadList.java +++ b/ui/src/com/android/providers/downloads/ui/DownloadList.java @@ -765,7 +765,9 @@ public class DownloadList extends Activity { // are all prefixes of the given mimetypes the same? ArrayList mimeTypePrefixes = new ArrayList(); for (String s : mimeTypes) { - mimeTypePrefixes.add(s.substring(0, s.indexOf('/'))); + if (s != null) { + mimeTypePrefixes.add(s.substring(0, s.indexOf('/'))); + } } str = findCommonString(mimeTypePrefixes); if (str != null) { -- cgit v1.2.3