Avoid NPE when checking file URI in DownloadProvider
Steve Howard [Fri, 1 Oct 2010 02:45:56 +0000 (19:45 -0700)]
Change-Id: Ic937b05308cecce244725e25767a3a1310a8463d

src/com/android/providers/downloads/DownloadProvider.java

index 2cbf7fb..9b86adf 100644 (file)
@@ -538,7 +538,8 @@ public final class DownloadProvider extends ContentProvider {
                     "DESTINATION_FILE_URI must include a file URI under COLUMN_FILE_NAME_HINT");
         }
         Uri uri = Uri.parse(fileUri);
-        if (!uri.getScheme().equals("file")) {
+        String scheme = uri.getScheme();
+        if (scheme == null || !scheme.equals("file")) {
             throw new IllegalArgumentException("Not a file URI: " + uri);
         }
         String path = uri.getPath();