1
0
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:
Richard Tibbetts 2008-11-02 03:56:13 +00:00
parent 4f798ae9cc
commit 6cd5ce7dee

View File

@ -337,25 +337,21 @@ public class LocalStore extends Store {
}
Cursor cursor = null;
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 = ?",
new String[] {
mName
});
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();
new String[] { mName });
if (cursor.moveToFirst()) {
mFolderId = cursor.getInt(0);
mUnreadMessageCount = cursor.getInt(1);
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) {
cursor.close();
}
@ -382,8 +378,8 @@ public class LocalStore extends Store {
Cursor cursor = null;
try {
cursor = mDb.rawQuery("SELECT id FROM folders "
+ "where folders.name = ?",
new String[] { this.getName() });
+ "where folders.name = ?", new String[] { this
.getName() });
if (cursor.moveToFirst()) {
int folderId = cursor.getInt(0);
return (folderId > 0) ? true : false;