Fix StaleDataException in changeCursor

Check whether the cursor is closed before trying to getColumnIndex

Bug 26926075

Change-Id: Iffb0694b153f39d871d536dd60113c0853af7211
diff --git a/common/java/com/android/common/widget/CompositeCursorAdapter.java b/common/java/com/android/common/widget/CompositeCursorAdapter.java
index 03443d9..beae8ea 100644
--- a/common/java/com/android/common/widget/CompositeCursorAdapter.java
+++ b/common/java/com/android/common/widget/CompositeCursorAdapter.java
@@ -220,7 +220,7 @@
                 prevCursor.close();
             }
             mPartitions.get(partition).cursor = cursor;
-            if (cursor != null) {
+            if (cursor != null && !cursor.isClosed()) {
                 mPartitions.get(partition).idColumnIndex = cursor.getColumnIndex("_id");
             }
             invalidate();