Skip to content

Commit

Permalink
ACC: Quickfix for setting lap driver when driver index is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mauserrifle committed Apr 30, 2024
1 parent cbc72c6 commit 94859bf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Simresults/Data/Reader/AssettoCorsaCompetizione.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ protected function readSessions()
}

// Set driver based on driver index (swapping support)
$lap->setDriver($lap_participant->getDriver($driverIndex+1));
$lap->setDriver($lap_participant->getDriver($driverIndex+1) ?:$lap_participant->getDriver(0));

// Is valid for best?
$valid_for_best = $this->helper->arrayGet($lap_data, 'isValidForBest');
Expand Down Expand Up @@ -604,9 +604,11 @@ protected function readSessions()
$driverIndex = $penalty_data['driverId'];;
}

$penalty_driver = $penalty_participant->getDriver($driverIndex+1) ?: $penalty_participant->getDriver(0);

// Set message
$penalty->setMessage(
$penalty_participant->getDriver($driverIndex+1)->getName().
$penalty_driver->getName().

' - '.
$this->helper->arrayGet($penalty_data, 'reason', 'Unknown reason').
Expand Down

0 comments on commit 94859bf

Please sign in to comment.