1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 05:02:26 -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
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);
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 {
} finally {
if (cursor != null) {
cursor.close();
}
}
return (mFolderId > 0 )? true : false;
}
@Override