Add null check for cursor in DirectoryListLoader

Bug: 12015142
Change-Id: Iaf7a97efb31e06402d583d399fa1f66f12e086d9
(cherry picked from commit 903c973e0ef995ee05acf8fa7501377afa971384)
diff --git a/src/com/android/contacts/common/list/DirectoryListLoader.java b/src/com/android/contacts/common/list/DirectoryListLoader.java
index be9a8e9..dedd62e 100644
--- a/src/com/android/contacts/common/list/DirectoryListLoader.java
+++ b/src/com/android/contacts/common/list/DirectoryListLoader.java
@@ -147,6 +147,9 @@
 
         Cursor cursor = context.getContentResolver().query(DirectoryQuery.URI,
                 DirectoryQuery.PROJECTION, selection, null, DirectoryQuery.ORDER_BY);
+        if (cursor == null) {
+            return result;
+        }
         try {
             while(cursor.moveToNext()) {
                 long directoryId = cursor.getLong(DirectoryQuery.ID);