1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -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 @Override
public boolean exists() throws MessagingException { public boolean exists() throws MessagingException {
Cursor cursor = null; Cursor cursor = null;
int mFolderId = 0 ; try {
try { cursor = mDb.rawQuery("SELECT id FROM folders "
cursor = mDb.rawQuery("SELECT id FROM folders " + "where folders.name = ?", new String[] { this.getName() }); + "where folders.name = ?",
cursor.moveToFirst(); new String[] { this.getName() });
mFolderId = cursor.getInt(0); if (cursor.moveToFirst()) {
} int folderId = cursor.getInt(0);
finally { return (folderId > 0) ? true : false;
if (cursor != null) { } else {
cursor.close(); return false;
} }
} } finally {
return (mFolderId > 0 )? true : false; if (cursor != null) {
} cursor.close();
}
}
}
@Override @Override
public boolean create(FolderType type) throws MessagingException { public boolean create(FolderType type) throws MessagingException {