mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-05 17:15:05 -05:00
Avoid CursorIndexOutOfBoundsException when deleting a message
Deleting a message creates an entry in EmailProviderCache so EmailProviderCacheCursor can skip the Cursor row during the time it takes to update the database. Previously EmailProviderCacheCursor.isLast() returned the wrong result when the last row in the wrapped Cursor was hidden. This lead to the crash in MergeCursor. Fixes issue 5820
This commit is contained in:
parent
b5f31af402
commit
aab998d17f
@ -19,6 +19,12 @@ public class EmailProviderCacheCursor extends CursorWrapper {
|
|||||||
private int mMessageIdColumn;
|
private int mMessageIdColumn;
|
||||||
private int mFolderIdColumn;
|
private int mFolderIdColumn;
|
||||||
private int mThreadRootColumn;
|
private int mThreadRootColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The cursor's current position.
|
||||||
|
*
|
||||||
|
* Note: This is only used when {@link #mHiddenRows} isn't empty.
|
||||||
|
*/
|
||||||
private int mPosition;
|
private int mPosition;
|
||||||
|
|
||||||
|
|
||||||
@ -126,4 +132,13 @@ public class EmailProviderCacheCursor extends CursorWrapper {
|
|||||||
|
|
||||||
return mPosition;
|
return mPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLast() {
|
||||||
|
if (mHiddenRows.isEmpty()) {
|
||||||
|
return super.isLast();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (mPosition == getCount() - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user