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.
[simgrid.git] / 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)