fix: handle empty blueprint exports from shopping list#627
Open
hcoona wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevent empty shopping lists from crashing blueprint export.
Detailed explanation
The shopping list can legitimately produce an empty visible list depending on the selected state, such as Built or Missing. The export UI still allowed blueprint export in that state, while the blueprint exporter assumed at least one item and indexed into the first goods entry.
Example UI steps that trigger the issue
Expected behavior
An empty visible shopping list should not crash the application. Export should either be unavailable in the UI or produce a safe empty blueprint payload.
Actual behavior
The export action can be invoked with no goods. The exporter then attempts to access the first item in an empty list and throws an out-of-range exception.
Fix
The exporter now handles empty goods lists explicitly and returns an empty blueprint in the same output format. The shopping list UI also disables export actions when the currently visible list is empty. A regression test covers empty goods export.