From 75b5ae65093d0c609c8d682767dd576e7c1cc992 Mon Sep 17 00:00:00 2001 From: milek7 Date: Sun, 1 Apr 2018 22:28:38 +0200 Subject: [PATCH] check for nullptr, crash fix --- Train.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Train.cpp b/Train.cpp index 2ffb74b2..75c0bde3 100644 --- a/Train.cpp +++ b/Train.cpp @@ -4992,7 +4992,7 @@ bool TTrain::Update( double const Deltatime ) // NOTE: crude way to have the pantographs go back up if they're dropped due to insufficient pressure etc // TODO: rework it into something more elegant, when redoing the whole consist/unit/cab etc arrangement - if( false == DynamicObject->Mechanik->AIControllFlag ) { + if( DynamicObject->Mechanik != nullptr && !DynamicObject->Mechanik->AIControllFlag ) { // don't mess with the ai driving, at least not while switches don't follow ai-set vehicle state if( ( mvControlled->Battery ) || ( mvControlled->ConverterFlag ) ) {