Blob Blame History Raw
From 6ec1e6af69ec7d71da81d133bb2a9c2977e16647 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Tue, 28 Oct 2014 11:49:25 +0100
Subject: [PATCH] Don't crash on CTRL+C in console if the simulation is not
 running

---
 src/sim_context.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/sim_context.cc b/src/sim_context.cc
index c4b8373..9276bd4 100644
--- a/src/sim_context.cc
+++ b/src/sim_context.cc
@@ -315,7 +315,8 @@ void CSimulationContext::NotifyUserCanceled() {
     m_pbUserCanceled = NULL;
     return;
   }
-  if(CSimulationContext::GetContext()->GetActiveCPU()->simulation_mode
+  if(CSimulationContext::GetContext()->GetActiveCPU() &&
+     CSimulationContext::GetContext()->GetActiveCPU()->simulation_mode
     == eSM_RUNNING) {
     // If we get a CTRL->C while processing a command file
     // we should probably stop the command file processing.
-- 
2.1.0