From dae9ca13aff00ab1c05f85514f756aea7506d99e Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 21 Oct 2015 18:55:49 +0200 Subject: [PATCH] Don't segfault when energy is not turned on --- src/surf/cpu_interface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 03cea6deee..345ad6cd37 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -230,6 +230,8 @@ void Cpu::setState(e_surf_resource_state_t state) void Cpu::setVirtual(Cpu *physCpu) { + if (!surf_energy) + return; this->physCpu = physCpu; XBT_DEBUG("The CPU is virtual so associate the cpu energy to the physical cpu instead of creating a new one"); std::map::iterator cpu_energy_it = surf_energy->find(physCpu); -- 2.20.1