Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / src / s4u / s4u_host.cpp
index a1520f9..f39b2a2 100644 (file)
@@ -87,9 +87,11 @@ Host* Host::by_name_or_null(const char* name)
 }
 Host* Host::by_name_or_null(std::string name)
 {
-  if (host_list.find(name) == host_list.end())
+  try {
+    return host_list.at(name);
+  } catch (std::out_of_range& unfound) {
     return nullptr;
-  return host_list.at(name);
+  }
 }
 
 Host *Host::current(){