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

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 // TODO: support for primary mode request passed as commanddata.param1
if( !sameconsist && isincharge ) { if( !sameconsist && isincharge ) {
// oddajemy dotychczasowy AI // oddajemy dotychczasowy AI
currentvehicle->Mechanik->TakeControl( true ); if (currentvehicle->Mechanik != nullptr)
currentvehicle->Mechanik->TakeControl( true );
} }
if( sameconsist && !aidriveractive ) { if( sameconsist && !aidriveractive ) {
// since we're consist owner we can simply move to the destination vehicle // since we're consist owner we can simply move to the destination vehicle
senderlocaltrain->MoveToVehicle( targetvehicle ); senderlocaltrain->MoveToVehicle( targetvehicle );
senderlocaltrain->Dynamic()->Mechanik->TakeControl( false, true ); if (senderlocaltrain->Dynamic()->Mechanik != nullptr)
senderlocaltrain->Dynamic()->Mechanik->TakeControl( false, true );
} }
} }