From 6d3564e7d62dcafa6b404748bb98d8b45de794d3 Mon Sep 17 00:00:00 2001 From: Paul Westbrook Date: Mon, 3 May 2010 15:34:14 -0700 Subject: [PATCH] Fix Gmail unit test Fix a NPE where, while running the unit tests, a download is not found Change-Id: I7c407112e5cfe7c39ceace25c48c6eba4f5dcfbe --- core/java/android/net/Downloads.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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; }