fix: invert guard in _load_deck_cards_by_name — was if not deck_row (crash on None[0])

The guard condition was inverted: `if not deck_row:` entered the query
block when no deck was found, causing `deck_row[0]` to crash with
'NoneType' object is not subscriptable. Flipped to `if deck_row:`
so the query runs only when the deck exists.
This commit is contained in:
KoalaTrapLord authored and GitHub committed 2026-03-21 15:11:08 -04:00
1 parent 1397f93b91
commit 06f007e605
1 file changed
+1 -1
+1 -1
View File
@@ -178,7 +178,7 @@ 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 not deck_row:
if deck_row:
deck_id = deck_row[0]
rows = conn.execute("""
SELECT dc.card_name, dc.quantity, dc.is_commander, dc.role_tag, dc.scryfall_id,