Skip to content

Commit

Permalink
fix: dont crash when equipping npc with no existing clothing (#4356)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekaratzas authored Mar 15, 2024
1 parent 21483ac commit 508ea38
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/armor_layers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,9 @@ void show_armor_layers_ui( Character &who )
if( loc ) {
// wear the item
loc->obtain( who );
if( !who.as_player()->wear_possessed( *loc, true, access_tmp_worn( leftListIndex ) ) &&
const std::optional<location_vector<item>::iterator> position = ( leftListSize > 0 ) ?
access_tmp_worn( leftListIndex ) : std::optional<location_vector<item>::iterator>( std::nullopt );
if( !who.as_player()->wear_possessed( *loc, true, position ) &&
who.is_npc() ) {
// TODO: Pass the reason here
popup( _( "Can't put this on!" ) );
Expand Down

0 comments on commit 508ea38

Please sign in to comment.