diff --git a/modules/cragr/api/browser.py b/modules/cragr/api/browser.py index a1d3ae291a81637e43693c114c1514c264966363..b2c330b19d9206d08f4435b1de06998196fcb1eb 100644 --- a/modules/cragr/api/browser.py +++ b/modules/cragr/api/browser.py @@ -255,6 +255,8 @@ def iter_accounts(self): main_account.owner_type = self.page.get_owner_type() main_account._contract = contract + else: + main_account = None space_type = self.page.get_space_type() accounts_list = list(self.page.iter_accounts()) @@ -283,12 +285,13 @@ def iter_accounts(self): account_balances.update(self.page.get_account_balances()) loan_ids.update(self.page.get_loan_ids()) - if main_account.type == Account.TYPE_CHECKING: - main_account.iban = self.get_account_iban(main_account._index, 1, main_account.id) + if main_account: + if main_account.type == Account.TYPE_CHECKING: + main_account.iban = self.get_account_iban(main_account._index, 1, main_account.id) - if main_account.id not in all_accounts: - all_accounts[main_account.id] = main_account - yield main_account + if main_account.id not in all_accounts: + all_accounts[main_account.id] = main_account + yield main_account for account in accounts_list: if empty(account.balance):