diff --git a/src/item_location.cpp b/src/item_location.cpp index ad86d6e5c4d3c..c15ffa2fb2d22 100644 --- a/src/item_location.cpp +++ b/src/item_location.cpp @@ -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;