am 123d4028: Make sure to close a cursor

* commit '123d40283e1411dcb5fa5def656ad352c101e5d0':
  Make sure to close a cursor
This commit is contained in:
Martin Hibdon 2014-11-02 15:32:50 +00:00 committed by Android Git Automerger
commit 4e79403856

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);
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