Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handled nowhere parent #75819

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/item_location.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,11 @@ void item_location::deserialize( const JsonObject &obj )
item_location parent;
obj.read( "parent", parent );
if( !parent.ptr->valid() ) {
if( parent == nowhere ) {
debugmsg( "parent location doesn't exist. Item_location has lost its target over a save/load cycle." );
ptr.reset( new impl::nowhere );
return;
}
debugmsg( "parent location does not point to valid item" );
ptr.reset( new impl::item_on_map( map_cursor( parent.pos_bub() ), idx ) ); // drop on ground
return;
Expand Down
Loading