1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Fix local folder query to not die when there are no local folders, like on first install

This commit is contained in:
Richard Tibbetts 2008-11-02 03:28:29 +00:00
parent 63f94c6db0
commit 4f798ae9cc

View File

@ -379,20 +379,23 @@ public class LocalStore extends Store {
@Override
public boolean exists() throws MessagingException {
Cursor cursor = null;
int mFolderId = 0 ;
try {
cursor = mDb.rawQuery("SELECT id FROM folders " + "where folders.name = ?", new String[] { this.getName() });
cursor.moveToFirst();
mFolderId = cursor.getInt(0);
}
finally {
if (cursor != null) {
cursor.close();
}
}
return (mFolderId > 0 )? true : false;
}
Cursor cursor = null;
try {
cursor = mDb.rawQuery("SELECT id FROM folders "
+ "where folders.name = ?",
new String[] { this.getName() });
if (cursor.moveToFirst()) {
int folderId = cursor.getInt(0);
return (folderId > 0) ? true : false;
} else {
return false;
}
} finally {
if (cursor != null) {
cursor.close();
}
}
}
@Override
public boolean create(FolderType type) throws MessagingException {