From d3f7c4268be950040c4d1fdcc0458eadc3d9d3c4 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Mon, 20 Mar 2017 17:18:28 +0100
Subject: [PATCH] set _lastenginePower in case it has not been set (switching
 from double-clutch to idle while disengaged

---
 .../Models/SimulationComponent/Impl/CombustionEngine.cs        | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
index 15508ae4b2..318ea49f4c 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs
@@ -626,6 +626,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
 					_idleStart = absTime;
 					_lastEnginePower = _engine.PreviousState.EnginePower;
 				}
+				if (_lastEnginePower == null) {
+					_lastEnginePower = _engine.PreviousState.EnginePower;
+				}
 				IResponse retVal;
 
 				var idleTime = absTime - _idleStart + dt;
-- 
GitLab