Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
It's an internal error if get_impl returns null. Add an assert to be sure.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 5 Jul 2021 13:17:29 +0000 (15:17 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 5 Jul 2021 13:17:29 +0000 (15:17 +0200)
(and hope to please fbinfer)

src/s4u/s4u_Link.cpp

index 74ad674..0f5c751 100644 (file)
@@ -40,7 +40,9 @@ kernel::resource::LinkImpl* Link::get_impl() const
   xbt_assert(
       get_sharing_policy() != SharingPolicy::SPLITDUPLEX,
       "Impossible to get a LinkImpl* from a Split-Duplex link. You should call this method to each UP/DOWN member");
-  return dynamic_cast<kernel::resource::LinkImpl*>(pimpl_);
+  auto* link_impl = dynamic_cast<kernel::resource::LinkImpl*>(pimpl_);
+  xbt_assert(link_impl != nullptr);
+  return link_impl;
 }
 
 Link* Link::by_name_or_null(const std::string& name)