possible nullptr workaround, but without understanding

This commit is contained in:
milek7
2022-04-09 21:09:32 +02:00
parent fda53415e8
commit 020fa3ab05

View File

@@ -258,13 +258,15 @@ void state_manager::process_commands() {
// TODO: support for primary mode request passed as commanddata.param1
if( !sameconsist && isincharge ) {
// oddajemy dotychczasowy AI
currentvehicle->Mechanik->TakeControl( true );
if (currentvehicle->Mechanik != nullptr)
currentvehicle->Mechanik->TakeControl( true );
}
if( sameconsist && !aidriveractive ) {
// since we're consist owner we can simply move to the destination vehicle
senderlocaltrain->MoveToVehicle( targetvehicle );
senderlocaltrain->Dynamic()->Mechanik->TakeControl( false, true );
if (senderlocaltrain->Dynamic()->Mechanik != nullptr)
senderlocaltrain->Dynamic()->Mechanik->TakeControl( false, true );
}
}