From: Martin Quinson Date: Mon, 8 Jul 2019 16:08:15 +0000 (+0200) Subject: Don't use null objects X-Git-Tag: v3.23.2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5c2fa73cd308b08d88910f5f28df80cdde7f2243 Don't use null objects Fixes https://github.com/simgrid/simgrid/issues/328 --- diff --git a/ChangeLog b/ChangeLog index 4d32295f14..859a17cc98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ XBT: Bugs: - Really fix FG#26: Turning off a link should raise NetworkFailureException - FG#27: Wrong exception thrown to wait_any when link is turned off + - GH#328: Java: Canceling multiple tasks in a single vm/host ---------------------------------------------------------------------------- diff --git a/src/plugins/host_load.cpp b/src/plugins/host_load.cpp index 19c495f75c..45b89e76fd 100644 --- a/src/plugins/host_load.cpp +++ b/src/plugins/host_load.cpp @@ -96,12 +96,13 @@ void HostLoad::update() while (iter != end(current_activities)) { auto& activity = iter->first; // Just an alias auto& remaining_cost_after_last_update = iter->second; // Just an alias + auto& action = activity->surf_action_; auto current_iter = iter; ++iter; - if (activity->surf_action_->get_finish_time() != now && activity->state_ == e_smx_state_t::SIMIX_RUNNING) { + if (action != nullptr && action->get_finish_time() != now && activity->state_ == e_smx_state_t::SIMIX_RUNNING) { if (remaining_cost_after_last_update == activity_uninitialized_remaining_cost) { - remaining_cost_after_last_update = activity->surf_action_->get_cost(); + remaining_cost_after_last_update = action->get_cost(); } double computed_flops_since_last_update = remaining_cost_after_last_update - /*remaining now*/activity->get_remaining(); computed_flops_ += computed_flops_since_last_update;