diff --git a/src/server.cpp b/src/server.cpp index 43b8f02a8..8ea65b18b 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -482,7 +482,13 @@ void Server::init() // Register us to receive map edit events servermap->addEventReceiver(this); - m_env->loadMeta(); + try { + m_env->loadMeta(); + } catch (SerializationError &e) { + warningstream << "Environment metadata is corrupted: " << e.what() << std::endl; + warningstream << "Loading the default instead" << std::endl; + m_env->loadDefaultMeta(); + } // Those settings can be overwritten in world.mt, they are // intended to be cached after environment loading. diff --git a/src/serverenvironment.h b/src/serverenvironment.h index 1a4daa341..146572a0f 100644 --- a/src/serverenvironment.h +++ b/src/serverenvironment.h @@ -368,13 +368,13 @@ public: const bool isCompatPlayerModel(const std::string &model_name); inline bool getCompatSendOriginalModel() { return m_compat_send_original_model; } -private: /** * called if env_meta.txt doesn't exist (e.g. new world) */ void loadDefaultMeta(); +private: static PlayerDatabase *openPlayerDatabase(const std::string &name, const std::string &savedir, const Settings &conf); static AuthDatabase *openAuthDatabase(const std::string &name,