16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 14:39:18 +02:00

check for nullptr, crash fix

This commit is contained in:
milek7
2018-04-01 22:28:38 +02:00
parent 3d0024ab15
commit 75b5ae6509

View File

@@ -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 ) ) {