diff --git a/src/catalua.cpp b/src/catalua.cpp index d9318f9c5728..363687ab5f04 100644 --- a/src/catalua.cpp +++ b/src/catalua.cpp @@ -205,6 +205,10 @@ bool save_world_lua_state( const std::string &path ) JsonOut jsout( stream ); jsout.start_object(); for( const mod_id &mod : mods ) { + if( !mod.is_valid() ) { + // The mod is missing from installation + continue; + } jsout.member( mod.str() ); serialize_lua_table( t[mod.str()], jsout ); } @@ -228,6 +232,10 @@ bool load_world_lua_state( const std::string &path ) // Mod could have been added to existing save continue; } + if( !mod.is_valid() ) { + // Trying to load without the mod + continue; + } JsonObject mod_obj = jsobj.get_object( mod.str() ); deserialize_lua_table( t[mod.str()], mod_obj ); }