mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Fix similar empty-cursor bug when creating a folder on open.
Turn tabs into spaces in code I changed last commit.
This commit is contained in:
parent
4f798ae9cc
commit
6cd5ce7dee
@ -337,25 +337,21 @@ public class LocalStore extends Store {
|
|||||||
}
|
}
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
try {
|
try {
|
||||||
cursor = mDb.rawQuery("SELECT id, unread_count, visible_limit FROM folders "
|
cursor = mDb.rawQuery(
|
||||||
|
"SELECT id, unread_count, visible_limit FROM folders "
|
||||||
+ "where folders.name = ?",
|
+ "where folders.name = ?",
|
||||||
new String[] {
|
new String[] { mName });
|
||||||
mName
|
if (cursor.moveToFirst()) {
|
||||||
});
|
|
||||||
if ( cursor.getCount() == 0 ) {
|
|
||||||
// Calling exists on open is a little expensive. Instead, just handle it when we don't find it.
|
|
||||||
create(FolderType.HOLDS_MESSAGES);
|
|
||||||
open(mode);
|
|
||||||
|
|
||||||
}
|
|
||||||
cursor.moveToFirst();
|
|
||||||
mFolderId = cursor.getInt(0);
|
mFolderId = cursor.getInt(0);
|
||||||
mUnreadMessageCount = cursor.getInt(1);
|
mUnreadMessageCount = cursor.getInt(1);
|
||||||
mVisibleLimit = cursor.getInt(2);
|
mVisibleLimit = cursor.getInt(2);
|
||||||
|
} else {
|
||||||
|
// Calling exists on open is a little expensive. Instead,
|
||||||
|
// just handle it when we don't find it.
|
||||||
|
create(FolderType.HOLDS_MESSAGES);
|
||||||
|
open(mode);
|
||||||
}
|
}
|
||||||
finally {
|
} finally {
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.close();
|
cursor.close();
|
||||||
}
|
}
|
||||||
@ -382,8 +378,8 @@ public class LocalStore extends Store {
|
|||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
try {
|
try {
|
||||||
cursor = mDb.rawQuery("SELECT id FROM folders "
|
cursor = mDb.rawQuery("SELECT id FROM folders "
|
||||||
+ "where folders.name = ?",
|
+ "where folders.name = ?", new String[] { this
|
||||||
new String[] { this.getName() });
|
.getName() });
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
int folderId = cursor.getInt(0);
|
int folderId = cursor.getInt(0);
|
||||||
return (folderId > 0) ? true : false;
|
return (folderId > 0) ? true : false;
|
||||||
|
Loading…
Reference in New Issue
Block a user