Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sonar don't like comments ending with ';'
[simgrid.git] / src / kernel / activity / MailboxImpl.cpp
index 936b249..8a68981 100644 (file)
@@ -13,7 +13,7 @@ static std::map<std::string, smx_mailbox_t>* mailboxes = new std::map<std::strin
 
 void SIMIX_mailbox_exit()
 {
-  for (auto elm : *mailboxes)
+  for (auto const& elm : *mailboxes)
     delete elm.second;
   delete mailboxes;
 }
@@ -53,7 +53,10 @@ MailboxImpl* MailboxImpl::byNameOrCreate(const char* name)
  */
 void MailboxImpl::setReceiver(s4u::ActorPtr actor)
 {
-  this->permanent_receiver = actor.get()->getImpl();
+  if (actor != nullptr)
+    this->permanent_receiver = actor.get()->getImpl();
+  else
+    this->permanent_receiver = nullptr;
 }
 /** @brief Pushes a communication activity into a mailbox
  *  @param comm What to add
@@ -73,14 +76,14 @@ void MailboxImpl::remove(smx_activity_t activity)
       boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(activity);
 
   xbt_assert(comm->mbox == this, "Comm %p is in mailbox %s, not mailbox %s", comm.get(),
-             (comm->mbox ? comm->mbox->name_ : "(null)"), this->name_);
+             (comm->mbox ? comm->mbox->getCname() : "(null)"), this->getCname());
   comm->mbox = nullptr;
   for (auto it = this->comm_queue.begin(); it != this->comm_queue.end(); it++)
     if (*it == comm) {
       this->comm_queue.erase(it);
       return;
     }
-  xbt_die("Comm %p not found in mailbox %s", comm.get(), this->name_);
+  xbt_die("Comm %p not found in mailbox %s", comm.get(), this->getCname());
 }
 }
 }