diff --git a/src/Server.cc b/src/Server.cc index d68d612117..fc28f36266 100644 --- a/src/Server.cc +++ b/src/Server.cc @@ -16,6 +16,7 @@ */ #include +#include #ifdef HAVE_PYBIND11 #include @@ -96,6 +97,17 @@ Server::Server(const ServerConfig &_config) addResourcePaths(); + auto hasBlockingErrors = [](const sdf::Errors &_errors) { + std::unordered_set nonBlockingErrors = + {sdf::ErrorCode::URI_LOOKUP}; + for (auto &err : _errors) + { + if (nonBlockingErrors.find(err.Code()) == nonBlockingErrors.end()) + return true; + } + return false; + }; + sdf::Errors errors; switch (_config.Source()) @@ -158,7 +170,7 @@ Server::Server(const ServerConfig &_config) // a black screen (search for "Async resource download" in // 'src/gui_main.cc'. errors = sdfRoot.Load(filePath, sdfParserConfig); - if (errors.empty()) { + if (!hasBlockingErrors(errors)) { if (sdfRoot.Model() == nullptr) { this->dataPtr->sdfRoot = std::move(sdfRoot); } @@ -173,7 +185,7 @@ Server::Server(const ServerConfig &_config) return; } world->AddModel(*sdfRoot.Model()); - if (errors.empty()) { + if (!hasBlockingErrors(errors)) { errors = this->dataPtr->sdfRoot.UpdateGraphs(); } } @@ -198,7 +210,8 @@ Server::Server(const ServerConfig &_config) { for (auto &err : errors) gzerr << err << "\n"; - return; + if (hasBlockingErrors(errors)) + return; } // Add record plugin