diff options
Diffstat (limited to 'java/com/android/dialer')
-rw-r--r-- | java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java | 6 | ||||
-rw-r--r-- | java/com/android/dialer/searchfragment/directories/DirectoriesCursorLoader.java | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java b/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java index 57e253c7e..7caa314f3 100644 --- a/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java +++ b/java/com/android/dialer/searchfragment/cp2/SearchContactsCursorLoader.java @@ -103,7 +103,8 @@ public final class SearchContactsCursorLoader extends CursorLoader { static class SmartDialCursor extends MergeCursor implements SearchCursor { static SmartDialCursor newInstance(Context context, Cursor smartDialCursor) { - if (smartDialCursor.getCount() == 0) { + if (smartDialCursor == null || smartDialCursor.getCount() == 0) { + LogUtil.i("SmartDialCursor.newInstance", "Cursor was null or empty"); return new SmartDialCursor(new Cursor[] {new MatrixCursor(Projections.CP2_PROJECTION)}); } @@ -173,7 +174,8 @@ public final class SearchContactsCursorLoader extends CursorLoader { static class RegularSearchCursor extends MergeCursor implements SearchCursor { static RegularSearchCursor newInstance(Context context, Cursor regularSearchCursor) { - if (regularSearchCursor.getCount() == 0) { + if (regularSearchCursor == null || regularSearchCursor.getCount() == 0) { + LogUtil.i("RegularSearchCursor.newInstance", "Cursor was null or empty"); return new RegularSearchCursor(new Cursor[] {new MatrixCursor(Projections.CP2_PROJECTION)}); } diff --git a/java/com/android/dialer/searchfragment/directories/DirectoriesCursorLoader.java b/java/com/android/dialer/searchfragment/directories/DirectoriesCursorLoader.java index dbe11dd96..4d7ea3f3d 100644 --- a/java/com/android/dialer/searchfragment/directories/DirectoriesCursorLoader.java +++ b/java/com/android/dialer/searchfragment/directories/DirectoriesCursorLoader.java @@ -71,6 +71,11 @@ public final class DirectoriesCursorLoader extends CursorLoader { * @return A list of directories. */ public static List<Directory> toDirectories(Cursor cursor) { + if (cursor == null) { + LogUtil.i("DirectoriesCursorLoader.toDirectories", "Cursor was null"); + return new ArrayList<>(); + } + List<Directory> directories = new ArrayList<>(); cursor.moveToPosition(-1); while (cursor.moveToNext()) { |