From 0c3e85038bbe611cb4bdeba256a6ef2a5fb2e113 Mon Sep 17 00:00:00 2001 From: Matt Gleason Date: Tue, 18 Jul 2023 15:20:58 -0500 Subject: [PATCH] SFT-2454: added MemoryError handling for saving to microSD --- .../modules/flows/sign_psbt_qr_flow.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py b/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py index d5931fbe8..228d32317 100644 --- a/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py +++ b/ports/stm32/boards/Passport/modules/flows/sign_psbt_qr_flow.py @@ -187,12 +187,18 @@ async def save_to_microsd(self): # Add -signed to end. We won't offer to sign again. target_fname = base + '-signed.psbt' - self.filename = await SaveToMicroSDFlow(filename=target_fname, - data=b2a_hex(self.signed_bytes), - success_text="psbt", - path=get_folder_path(DIR_TRANSACTIONS), - automatic=False, - auto_prompt=True).run() + try: + self.filename = await SaveToMicroSDFlow(filename=target_fname, + data=b2a_hex(self.signed_bytes), + success_text="psbt", + path=get_folder_path(DIR_TRANSACTIONS), + automatic=False, + auto_prompt=True).run() + except MemoryError as e: + await ErrorPage(text='Transaction is too complex: {}'.format(e)).show() + self.set_result(False) + return + if self.filename is None: self.back() return