From: Martin Quinson Date: Wed, 21 Oct 2015 16:55:49 +0000 (+0200) Subject: Don't segfault when energy is not turned on X-Git-Tag: v3_13~1639 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/dae9ca13aff00ab1c05f85514f756aea7506d99e?ds=sidebyside Don't segfault when energy is not turned on --- 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);