Skip to content

Commit

Permalink
Merge pull request #79556 from marilynias/fix-insert
Browse files Browse the repository at this point in the history
fix insert item segfault
  • Loading branch information
Maleclypse authored Feb 6, 2025
2 parents bfaee8a + 89a6709 commit 4091893
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/activity_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5115,7 +5115,7 @@ static ret_val<void> try_insert( item_location &holster, drop_location &holstere
}
ret = holster.parents_can_contain_recursive( &it );
if( !ret.success() ) {
if( carrier->is_avatar() && query_yn(
if( carrier != nullptr && carrier->is_avatar() && query_yn(
_( "The parent container does not have enough space to fit more items. Would you like to first wield %s to fit more?" ),
holster->tname() )
&&
Expand All @@ -5142,7 +5142,8 @@ static ret_val<void> try_insert( item_location &holster, drop_location &holstere
ret_val<int> max_parent_charges = holster.max_charges_by_parent_recursive( it );
if( !max_parent_charges.success() ) {
return ret_val<void>::make_failure( max_parent_charges.str() );
} else if( carrier->is_avatar() && max_parent_charges.value() < holstered_item.second ) {
} else if( carrier != nullptr && carrier->is_avatar() &&
max_parent_charges.value() < holstered_item.second ) {
// if you cannot fit all items because parent container is too small
if( query_yn(
_( "The parent container does not have enough space to fit more than %i %s. Would you like to first wield %s to fit more?" ),
Expand Down

0 comments on commit 4091893

Please sign in to comment.