fix key error

This commit is contained in:
tooomm
2025-08-10 13:27:41 +02:00
parent 04150f692e
commit 6a14f8889e

View File

@@ -213,12 +213,9 @@ def scryfall2mtgjson(scryfall_cards: List[Dict[str, Any]]) -> List[Dict[str, Any
for sf_card in composed_sf_cards:
super_types, types, sub_types = build_types(sf_card)
if "//" in sf_card.get("name", ""):
image = (
sf_card["card_faces"][0]
.get("image_uris", {})
.get("normal", "")
)
card_faces = sf_card.get("card_faces")
if card_faces and isinstance(card_faces, list) and len(card_faces) > 0:
image = card_faces[0].get("image_uris", {}).get("normal", "")
else:
image = sf_card.get("image_uris", {}).get("normal", "")