From aaeae3a07fdbc3a9a8c8b76d6404af4503f908e4 Mon Sep 17 00:00:00 2001 From: Pepijn de Vos Date: Wed, 1 Apr 2026 21:02:30 +0200 Subject: [PATCH] Fix item count for socketed jewels in _parse_items The `continue` after handling a socketed jewel skips the `items_count -= 1` at the bottom of the loop, causing the parser to read past the end of the item list. This crashes when parsing characters with socketed jewels in mercenary (or other) items, as the next section header is misinterpreted as an item header. Co-Authored-By: Claude Opus 4.6 (1M context) --- d2lib/files.py | 1 + 1 file changed, 1 insertion(+) diff --git a/d2lib/files.py b/d2lib/files.py index 1a907f3..f0ef84a 100644 --- a/d2lib/files.py +++ b/d2lib/files.py @@ -103,6 +103,7 @@ def _parse_items(self, skip_items_header=False): if item.code == 'jew': socketed_item.magic_attrs.extend(item.magic_attrs) socketed_item.socketed_items.append(item) + items_count -= 1 continue raise ItemParseError(f'Unknown item: {item.code}')