[game][gui] Fix crash when opening K2 containers#102
Open
Eldbury wants to merge 1 commit intomodawan:masterfrom
Open
[game][gui] Fix crash when opening K2 containers#102Eldbury wants to merge 1 commit intomodawan:masterfrom
Eldbury wants to merge 1 commit intomodawan:masterfrom
Conversation
Owner
|
A couple of nitpicks, otherwise LGTM. |
modawan
reviewed
Apr 27, 2026
| auto creatureActor = _game.getObjectById<Creature>(actor.id()); | ||
| auto placeable = std::static_pointer_cast<Placeable>(_object); | ||
| bool reached = creatureActor->navigateTo(placeable->position(), true, kDefaultMaxObjectDistance, dt); | ||
| if (!_object || actor.type() != ObjectType::Creature) { |
Owner
There was a problem hiding this comment.
Suggested change
| if (!_object || actor.type() != ObjectType::Creature) { | |
| if (!_object || !isa<Creature>(actor)) { |
| return; | ||
| } | ||
|
|
||
| auto &creatureActor = static_cast<Creature &>(actor); |
Owner
There was a problem hiding this comment.
Suggested change
| auto &creatureActor = static_cast<Creature &>(actor); | |
| auto &creatureActor = cast<Creature>(actor); |
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
Fixes crashes when opening certain KOTOR 2 containers.
The container action path now keeps the original object target instead of assuming every container target is a placeable. This avoids unsafe placeable-only handling for object-shaped container targets such as corpse loot.
Also guards image-button icon rendering when the icon font is unavailable, falling back to the control text font where possible.
Testing
engineandlauncherinRelWithDebInfoon Windowsgit diff --check upstream/master...HEADsrc/libs/game/action/opencontainer.cppsrc/libs/gui/control/imagebutton.cppManual verification