Skip to content

Fix item count for socketed jewels#8

Open
pepijndevos wants to merge 1 commit intoartcom-net:masterfrom
pepijndevos:fix-jewel-item-count
Open

Fix item count for socketed jewels#8
pepijndevos wants to merge 1 commit intoartcom-net:masterfrom
pepijndevos:fix-jewel-item-count

Conversation

@pepijndevos
Copy link
Copy Markdown

Summary

  • The continue after handling a socketed jewel in _parse_items skips the items_count -= 1 at the bottom of the loop, causing the parser to over-read by one item per jewel
  • This crashes when parsing characters with socketed jewels in mercenary items, as the next section header (e.g. golem 0x6B66) is misinterpreted as an item header

Reproduction

Any .d2s file where a mercenary item has a socketed jewel triggers:

d2lib.errors.ItemParseError: Invalid item header id: 666B

Fix

Add items_count -= 1 before the continue on line 106, matching the decrement at the bottom of the loop.

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant