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

@ -380,18 +380,21 @@ 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 " + "where folders.name = ?", new String[] { this.getName() }); cursor = mDb.rawQuery("SELECT id FROM folders "
cursor.moveToFirst(); + "where folders.name = ?",
mFolderId = cursor.getInt(0); new String[] { this.getName() });
if (cursor.moveToFirst()) {
int folderId = cursor.getInt(0);
return (folderId > 0) ? true : false;
} else {
return false;
} }
finally { } finally {
if (cursor != null) { if (cursor != null) {
cursor.close(); cursor.close();
} }
} }
return (mFolderId > 0 )? true : false;
} }
@Override @Override