diff --git a/ports/stm32/boards/Passport/modules/flows/temporary_seed_flow.py b/ports/stm32/boards/Passport/modules/flows/temporary_seed_flow.py index 643c6ca7d..dea360732 100644 --- a/ports/stm32/boards/Passport/modules/flows/temporary_seed_flow.py +++ b/ports/stm32/boards/Passport/modules/flows/temporary_seed_flow.py @@ -41,10 +41,7 @@ async def clear_seed(self): settings.exit_temporary_mode() # await spinner_task('Clearing temporary seed', delay_task, args=[1000, False]) await SuccessPage(text='Temporary Seed Cleared').show() - - self.set_result(True) - ui.full_cards_refresh() - await self.wait_to_die() + await self.finalize() async def use_child_seed(self): from derived_key import get_key_type_from_tn @@ -84,7 +81,9 @@ async def use_child_seed(self): return await SuccessPage(text='Temporary Seed Applied').show() + await self.finalize() + async def finalize(self): self.set_result(True) - ui.full_cards_refresh() + ui.full_cards_refresh(go_to_account_0=True) await self.wait_to_die() diff --git a/ports/stm32/boards/Passport/modules/ui/ui.py b/ports/stm32/boards/Passport/modules/ui/ui.py index ed566121f..68f045d4d 100644 --- a/ports/stm32/boards/Passport/modules/ui/ui.py +++ b/ports/stm32/boards/Passport/modules/ui/ui.py @@ -98,8 +98,10 @@ def set_screen_bg_color(self, bg_color): self.active_screen.set_bg_color(bg_color) def set_cards(self, card_descs, active_idx=0): - assert(active_idx >= 0) - assert(active_idx < len(card_descs)) + # An index out of bounds could occur when the account/passphrase/seed changes + # and the active_idx isnt updated + if active_idx < 0 or active_idx > len(card_descs): + active_idx = 1 # print('set_cards: len={}'.format(len(card_descs))) self.card_descs = card_descs @@ -336,13 +338,13 @@ def on_nav_right(self): self.next_card() # Full refresh - def full_cards_refresh(self): + def full_cards_refresh(self, go_to_account_0=False): from utils import start_task self.update_cards() async def restart_main_task(): - self.start_card_task(card_idx=self.active_card_idx) + self.start_card_task(card_idx=(1 if go_to_account_0 else self.active_card_idx)) start_task(restart_main_task())