Skip to content

Fix bp_null debugmsg on character encumbrance panel - #88519

Open
smickles wants to merge 1 commit into
CleverRaven:masterfrom
smickles:fix-encumbrance-bp-null
Open

Fix bp_null debugmsg on character encumbrance panel#88519
smickles wants to merge 1 commit into
CleverRaven:masterfrom
smickles:fix-encumbrance-bp-null

Conversation

@smickles

@smickles smickles commented Sep 4, 2026

Copy link
Copy Markdown

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:

Could not find equivalent bodypart id bp_null in <name>'s body

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_info default-constructed a bodypart_id (bp_null) and always called get_encumbrance_description, which unconditionally looks the part up via Creature::get_part.

Skip that lookup when line is past the body-part list. This matches draw_traits_info, draw_bionics_info, and draw_effects_info in the same file.

Describe alternatives you've considered

Guarding inside get_encumbrance_description or get_part for 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 through draw_encumbrance_infoget_encumbrance_descriptionCreature::get_part_id.

I did not compile this branch. To verify:

  1. New character (vanilla body, no extra mods required).
  2. Open @.
  3. Select the encumbrance tab.
  4. Hover or move the cursor onto the blank space below the body-part list.

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.

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
@github-actions github-actions Bot added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` labels Sep 4, 2026
@github-actions github-actions Bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

astyled astyled PR, label is assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Errors on hovering over body part panel in character screen on saves converted from 0.G to 0.H

1 participant