am 1ae6e4d9: am 4e794038: am 123d4028: Make sure to close a cursor

* commit '1ae6e4d9dab4e98e2903ca140651fe43fbbb3358':
  Make sure to close a cursor
This commit is contained in:
Martin Hibdon 2014-11-02 17:37:36 +00:00 committed by Android Git Automerger
commit a1401e1c87

View File

@ -225,11 +225,17 @@ public final class Account extends EmailContent implements Parcelable {
new String[] {AccountColumns._ID},
AccountColumns.EMAIL_ADDRESS + "=?", new String[] {emailAddress},
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();
}
}
}
@Override