Fix bp_null debugmsg on character encumbrance panel - #88519
Open
smickles wants to merge 1 commit into
Open
Conversation
draw_encumbrance_info default-constructed a bodypart_id and still called get_encumbrance_description when the selected line was past the body-part list. Skip the lookup in that case, matching the other draw_*_info helpers. Fixes CleverRaven#76347
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
Bugfixes "Fix debug error when hovering empty space on the character encumbrance panel"
Purpose of change
Fixes #76347.
Opening the character info screen (
@) and selecting or hovering the blank space below the encumbrance list throws:The original report framed this as a 0.G→0.H save conversion problem. It is not: it still happens on 0.I and on current master, on a new character with a complete standard body. A later comment on #76347 already reproduced it by hovering that blank space.
Describe the solution
draw_encumbrance_infodefault-constructed abodypart_id(bp_null) and always calledget_encumbrance_description, which unconditionally looks the part up viaCreature::get_part.Skip that lookup when
lineis past the body-part list. This matchesdraw_traits_info,draw_bionics_info, anddraw_effects_infoin the same file.Describe alternatives you've considered
Guarding inside
get_encumbrance_descriptionorget_partfor a null id would also silence the message. The other info-pane helpers already skip the work when the selected line is invalid, so matching that pattern is the smaller and more local fix.Testing
Reproduced the original debugmsg on 0.I curses (
27939e2) with a new tourist_swimmer at the refugee center while@was open. The backtrace went throughdraw_encumbrance_info→get_encumbrance_description→Creature::get_part_id.I did not compile this branch. To verify:
@.Expected after this change: empty info pane, no debugmsg.
Additional context
Same code is still on master. Terminal-only and tiles both hit it; tiles is just the easier hover path.