Check for null before accessing pckg.
Leon Scroggins [Wed, 2 Feb 2011 18:51:53 +0000 (13:51 -0500)]
Prevents null pointer exception when using
DownloadManager.completedDownload

Change-Id: I53859705c5e925f2320491451e41a631e4fed715

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

index 80e0d22..c3856a5 100644 (file)
@@ -621,7 +621,7 @@ public final class DownloadProvider extends ContentProvider {
         }
 
         // TODO: replace this hack with something cleaner
-        if (pckg.equals(GSF_PACKAGE_NAME) &&
+        if (pckg != null && pckg.equals(GSF_PACKAGE_NAME) &&
                 (getContext().checkCallingPermission(Downloads.Impl.PERMISSION_ACCESS_ADVANCED)
                         == PackageManager.PERMISSION_GRANTED)) {
             filteredValues.put(Constants.OTA_UPDATE, Boolean.TRUE);