diff options
author | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-03-10 16:59:51 +0000 |
---|---|---|
committer | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-03-10 16:59:51 +0000 |
commit | 78692bfeeddeb9218cd24940ba6f828f86ee26a2 (patch) | |
tree | 0fc13fd92643f45f47367ee042360cbfee28b309 /common/java | |
parent | 9bd171c5eeb3c94cd0c50f3ec6906d706eee7fe8 (diff) | |
parent | 02ce5a07e060328c367326770f5451e945633aff (diff) | |
download | android_frameworks_ex-78692bfeeddeb9218cd24940ba6f828f86ee26a2.tar.gz android_frameworks_ex-78692bfeeddeb9218cd24940ba6f828f86ee26a2.tar.bz2 android_frameworks_ex-78692bfeeddeb9218cd24940ba6f828f86ee26a2.zip |
Merge tag 'android-5.1.0_r1' into HEADstaging/cm-12.1stable/cm-12.1-YOG7Dstable/cm-12.1-YOG4Pstable/cm-12.1-YOG3Ccm-12.1
Android 5.1.0 release 1
Change-Id: I11a3d0ee668ab4fd9ad7f07decbdf99c57024291
Diffstat (limited to 'common/java')
-rw-r--r-- | common/java/com/android/common/widget/CompositeCursorAdapter.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/common/java/com/android/common/widget/CompositeCursorAdapter.java b/common/java/com/android/common/widget/CompositeCursorAdapter.java index dddbcf6..8a3fa9b 100644 --- a/common/java/com/android/common/widget/CompositeCursorAdapter.java +++ b/common/java/com/android/common/widget/CompositeCursorAdapter.java @@ -170,7 +170,12 @@ public abstract class CompositeCursorAdapter extends BaseAdapter { mCount = 0; for (Partition partition : mPartitions) { Cursor cursor = partition.cursor; - int count = cursor != null ? cursor.getCount() : 0; + int count; + if (cursor == null || cursor.isClosed()) { + count = 0; + } else { + count = cursor.getCount(); + } if (partition.hasHeader) { if (count != 0 || partition.showIfEmpty) { count++; @@ -428,7 +433,9 @@ public abstract class CompositeCursorAdapter extends BaseAdapter { return null; } Cursor cursor = mPartition.cursor; - cursor.moveToPosition(offset); + if (cursor == null || cursor.isClosed() || !cursor.moveToPosition(offset)) { + return null; + } return cursor; } start = end; |