fix: early return in _load_deck_cards_by_name when deck not found in DB

Fixes UnboundLocalError crash when deck_row is None by returning an
empty list instead of falling through to a query with an unbound deck_id.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 4.6 committed 2026-03-22 07:25:39 +00:00
1 parent 8c2a8cf1c1
commit 978fb12969
1 file changed
+2 -1
+2 -1
View File
@@ -178,7 +178,8 @@ def _load_deck_cards_by_name(deck_name: str) -> list:
"""Load cards from a deck by name, returning list of card dicts."""
conn = _get_db_conn()
deck_row = conn.execute("SELECT id FROM decks WHERE name = ?", (deck_name,)).fetchone()
if deck_row:
if not deck_row:
return []
deck_id = deck_row[0]
rows = conn.execute("""
SELECT dc.card_name, dc.quantity, dc.is_commander, dc.role_tag, dc.scryfall_id,