From 94859bf62660a35cc0f9fb2290a152a7dae0be0b Mon Sep 17 00:00:00 2001 From: Maurice van der Star Date: Tue, 30 Apr 2024 07:53:17 +0200 Subject: [PATCH] ACC: Quickfix for setting lap driver when driver index is not found --- lib/Simresults/Data/Reader/AssettoCorsaCompetizione.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Simresults/Data/Reader/AssettoCorsaCompetizione.php b/lib/Simresults/Data/Reader/AssettoCorsaCompetizione.php index b59503e..692754f 100644 --- a/lib/Simresults/Data/Reader/AssettoCorsaCompetizione.php +++ b/lib/Simresults/Data/Reader/AssettoCorsaCompetizione.php @@ -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'); @@ -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').