diff --git a/core/java/android/net/Downloads.java b/core/java/android/net/Downloads.java index fd33781981216..ddde5c1bbc414 100644 --- a/core/java/android/net/Downloads.java +++ b/core/java/android/net/Downloads.java @@ -430,11 +430,10 @@ public final class Downloads { ContentResolver cr = context.getContentResolver(); - Cursor c = cr.query( - downloadUri, DOWNLOADS_PROJECTION, null /* selection */, null /* selection args */, - null /* sort order */); + Cursor c = cr.query(downloadUri, DOWNLOADS_PROJECTION, null /* selection */, + null /* selection args */, null /* sort order */); try { - if (!c.moveToNext()) { + if (c == null || !c.moveToNext()) { return result; }