Skip to content

Commit

Permalink
Handle #undefined license color without thorwing an exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robertsmania committed Mar 29, 2024
1 parent ff8a567 commit 461b545
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions RobertsmaniaReplay/VAPlugin_RobertsmaniaReplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,12 +1024,18 @@ private static void OnSessionInfoUpdated(object sender, SdkWrapper.SessionInfoUp
}
}
if (e.SessionInfo["DriverInfo"]["Drivers"]["CarIdx", i]["LicColor"].TryGetValue(out string licColorStr))
{
if (licColorStr != "")
if (licColorStr != "" && !licColorStr.Contains("undefined"))
{
licColor = "#" + Convert.ToInt32(licColorStr, 16).ToString("X6");
}
}
else
{
// Handle the case where licColorStr is "undefined" or empty
// For example, you could log a warning or set a default color
_vaProxy.WriteToLog($"LicColor is not defined or is 'undefined': {licColorStr}", "yellow");
licColor = "#FFFFFF"; // Set a default color if 'LicColor' is 'undefined' or empty
}

if (e.SessionInfo["DriverInfo"]["Drivers"]["CarIdx", i]["CarClassID"].TryGetValue(out string carClassIdStr))
{
if (carClassIdStr != "")
Expand Down

0 comments on commit 461b545

Please sign in to comment.