diff options
Diffstat (limited to 'emailcommon/src/com/android/emailcommon/provider/Account.java')
-rwxr-xr-x | emailcommon/src/com/android/emailcommon/provider/Account.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/emailcommon/src/com/android/emailcommon/provider/Account.java b/emailcommon/src/com/android/emailcommon/provider/Account.java index 513390b69..5a3ab7f3a 100755 --- a/emailcommon/src/com/android/emailcommon/provider/Account.java +++ b/emailcommon/src/com/android/emailcommon/provider/Account.java @@ -225,11 +225,17 @@ public final class Account extends EmailContent implements Parcelable { new String[] {AccountColumns._ID}, AccountColumns.EMAIL_ADDRESS + "=?", new String[] {emailAddress}, null); - if (c == null || !c.moveToFirst()) { - return null; + try { + if (c == null || !c.moveToFirst()) { + return null; + } + final long id = c.getLong(c.getColumnIndex(AccountColumns._ID)); + return restoreAccountWithId(context, id, observer); + } finally { + if (c != null) { + c.close(); + } } - final long id = c.getLong(c.getColumnIndex(AccountColumns._ID)); - return restoreAccountWithId(context, id, observer); } @Override |