From ecd796b3a59923a00c8b35cde1855f681cda0f18 Mon Sep 17 00:00:00 2001 From: scgbckbone Date: Sun, 21 Dec 2025 22:24:08 +0100 Subject: [PATCH] bugfix: empty notes in hobbled mode --- releases/Next-ChangeLog.md | 2 +- shared/notes.py | 4 +++- testing/conftest.py | 2 +- testing/test_hobble.py | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/releases/Next-ChangeLog.md b/releases/Next-ChangeLog.md index 140fc78e..a847a737 100644 --- a/releases/Next-ChangeLog.md +++ b/releases/Next-ChangeLog.md @@ -22,6 +22,6 @@ This lists the new changes that have not yet been published in a normal release. ## 1.3.6Q - 2025-12-xx -- tbd +- Bugfix: Empty notes in hobbled mode caused yikes upon menu entry diff --git a/shared/notes.py b/shared/notes.py index d63bae46..89b23498 100644 --- a/shared/notes.py +++ b/shared/notes.py @@ -27,7 +27,6 @@ async def make_notes_menu(*a): # Read only version of menu system # - used when spending policy in effect # - must have some notes already, or unreachable - assert NoteContent.count() rv = NotesMenu(NotesMenu.construct_readonly()) rv.readonly = True return rv @@ -156,6 +155,9 @@ class NotesMenu(MenuSystem): rv.append(MenuItem('%d: %s' % (note.idx+1, note.title), menu=note.make_menu, arg=True)) # readonly=True + if not rv: + rv.append(MenuItem('(none saved yet)')) + return rv @classmethod diff --git a/testing/conftest.py b/testing/conftest.py index 3eae33f1..ecfbeec3 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -2675,7 +2675,7 @@ from test_ephemeral import verify_ephemeral_secret_ui, get_identity_story, get_s from test_msg import verify_msg_sign_story, sign_msg_from_text, msg_sign_export, sign_msg_from_address from test_multisig import import_ms_wallet, make_multisig, offer_ms_import, fake_ms_txn from test_multisig import make_ms_address, clear_ms, make_myself_wallet, import_multisig -from test_notes import need_some_notes, need_some_passwords +from test_notes import need_some_notes, need_some_passwords, goto_notes from test_nfc import try_sign_nfc, ndef_parse_txn_psbt from test_se2 import goto_trick_menu, clear_all_tricks, new_trick_pin, se2_gate, new_pin_confirmed from test_seed_xor import restore_seed_xor diff --git a/testing/test_hobble.py b/testing/test_hobble.py index 93e7b55e..f929c742 100644 --- a/testing/test_hobble.py +++ b/testing/test_hobble.py @@ -481,5 +481,19 @@ def test_h_seedxor(set_hobble, need_keypress, press_cancel, cap_screen, press_cancel() + +def test_empty_notes_bug(set_hobble, goto_notes, cap_menu, pick_menu_item, is_q1): + if not is_q1: + raise pytest.skip("No notes on Mk4") + + goto_notes() # enable notes - but do not add any + set_hobble(True, {"notes"}) + + pick_menu_item("Secure Notes & Passwords") + # here yikes would follow + time.sleep(.1) + m = cap_menu() + assert len(m) == 1 + assert m[0] == "(none saved yet)" # EOF