From 7c98e7f2d048c13ba2bcb434b33d251bd1d5a86a Mon Sep 17 00:00:00 2001 From: Bruno Donassolo Date: Thu, 4 Mar 2021 15:51:25 +0100 Subject: [PATCH] s4u_Host.cpp: clang-format --- src/s4u/s4u_Host.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index 1036f39880..8350971740 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -319,7 +319,8 @@ size_t sg_host_count() sg_host_t* sg_host_list() { const simgrid::s4u::Engine* e = simgrid::s4u::Engine::get_instance(); - size_t host_count = e->get_host_count(); + size_t host_count = e->get_host_count(); + xbt_assert(host_count > 0, "There is no host!"); std::vector hosts = e->get_all_hosts(); @@ -512,8 +513,9 @@ int sg_host_is_on(const_sg_host_t host) /** @brief Get the properties of a host */ xbt_dict_t sg_host_get_properties(const_sg_host_t host) { - xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f); const std::unordered_map* props = host->get_properties(); + xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f); + if (props == nullptr) return nullptr; for (auto const& elm : *props) { -- 2.20.1