From 06f007e6059bec0a56b0dd50d4134985e76ecc4c Mon Sep 17 00:00:00 2001 From: KoalaTrapLord <265133236+KoalaTrapLord@users.noreply.github.com> Date: Sat, 21 Mar 2026 15:11:08 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20invert=20guard=20in=20=5Fload=5Fdeck=5Fc?= =?UTF-8?q?ards=5Fby=5Fname=20=E2=80=94=20was=20`if=20not=20deck=5Frow`=20?= =?UTF-8?q?(crash=20on=20None[0])?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- services/deck_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/deck_service.py b/services/deck_service.py index 2eda397..26e57ce 100644 --- a/services/deck_service.py +++ b/services/deck_service.py @@ -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,