Skip to content

Commit

Permalink
AssettoCorsaServer: Quickfix for too large regex. Ignore exception
Browse files Browse the repository at this point in the history
  • Loading branch information
mauserrifle committed Jul 23, 2024
1 parent 4c2678e commit a910ebe
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/Simresults/Data/Reader/AssettoCorsaServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1170,12 +1170,19 @@ protected function parseLapData($data, $all_sessions_data, $all_data, &$particip
$data_session2_split = $data_session2_split[0];

// Tyre info found
if(preg_match_all($tyres_regex =
'/'.preg_quote($name, '/').".*? changed tyres to (.*?)\n"
.'/i', $data_session2_split, $tyre_matches))
{
$tyre_unique = array_unique($tyre_matches[1]);
$tyre = array_pop($tyre_matches[1]);
try {
if(preg_match_all($tyres_regex =
'/'.preg_quote($name, '/').".*? changed tyres to (.*?)\n"
.'/i', $data_session2_split, $tyre_matches))
{
$tyre_unique = array_unique($tyre_matches[1]);
$tyre = array_pop($tyre_matches[1]);
}
} catch (\Exception $ex) {
// Only bubble up exception when not too large exception
if (!preg_match('/too large/i', $ex->getMessage())) {
throw $ex;
}
}


Expand Down

0 comments on commit a910ebe

Please sign in to comment.