X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/86ad7bacaf8c0b206a62bf87193ca6800006a854..c897fb0d193bbe081581d7ea7f579f04df1b5b5d:/src/s4u/s4u_engine.cpp diff --git a/src/s4u/s4u_engine.cpp b/src/s4u/s4u_engine.cpp index 0e983e8ffe..8df13cd410 100644 --- a/src/s4u/s4u_engine.cpp +++ b/src/s4u/s4u_engine.cpp @@ -128,9 +128,11 @@ NetZone* Engine::getNetzoneByNameOrNull(const char* name) /** @brief Retrieve the netpoint of the given name (or nullptr if not found) */ simgrid::kernel::routing::NetPoint* Engine::getNetpointByNameOrNull(const char* name) { - if (pimpl->netpoints_.find(name) == pimpl->netpoints_.end()) + try { + return pimpl->netpoints_.at(name); + } catch (std::out_of_range& unfound) { return nullptr; - return pimpl->netpoints_.at(name); + } } /** @brief Fill the provided vector with all existing netpoints */ void Engine::getNetpointList(std::vector* list)