From 5c2fa73cd308b08d88910f5f28df80cdde7f2243 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 8 Jul 2019 18:08:15 +0200 Subject: [PATCH 1/1] Don't use null objects Fixes https://github.com/simgrid/simgrid/issues/328 --- ChangeLog | 1 + src/plugins/host_load.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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; -- 2.20.1