Fix potential crash when calling update but query db failed

This crash should not happen in normal case, but we can improve robustness of the code since ContentResolver.query() can possibly return null as its comment says

Fixes: 254186235
Test: manual
Change-Id: Ic4bb48b2f2048921681d7b3c45471c3b818f95b6
diff --git a/src/com/android/providers/downloads/DownloadNotifier.java b/src/com/android/providers/downloads/DownloadNotifier.java
index 3377432..f97f60c 100644
--- a/src/com/android/providers/downloads/DownloadNotifier.java
+++ b/src/com/android/providers/downloads/DownloadNotifier.java
@@ -24,6 +24,7 @@
 
 import static com.android.providers.downloads.Constants.TAG;
 
+import android.annotation.NonNull;
 import android.app.DownloadManager;
 import android.app.Notification;
 import android.app.NotificationChannel;
@@ -164,13 +165,17 @@
         try (Cursor cursor = mContext.getContentResolver().query(
                 Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, UpdateQuery.PROJECTION,
                 Downloads.Impl.COLUMN_DELETED + " == '0'", null, null)) {
+            if (cursor == null) {
+                Log.e(TAG, "Cursor is null, will ignore update");
+                return;
+            }
             synchronized (mActiveNotifs) {
                 updateWithLocked(cursor);
             }
         }
     }
 
-    private void updateWithLocked(Cursor cursor) {
+    private void updateWithLocked(@NonNull Cursor cursor) {
         final Resources res = mContext.getResources();
 
         // Cluster downloads together