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

* commit 'ffc9591cfcfcbc4811a003241e27c20de51afd59':
  Make sure to close a cursor
This commit is contained in:
Martin Hibdon 2014-11-02 19:02:29 +00:00 committed by Android Git Automerger
commit f214c7effe

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