Added more robustness to config lookup

This commit is contained in:
Paul Dino Jones 2024-09-06 14:50:00 -04:00
parent 9e09a2792a
commit d1629dfcbd
1 changed files with 13 additions and 4 deletions

View File

@ -214,7 +214,10 @@ int getconfigtouse(const char* config_file_str, char* car, int sim)
}
slogt("checking if car is matched %i", j);
temp = NULL;
found = config_setting_lookup_string(config_config, "car", &temp);
if(temp != NULL && found > 0)
{
if(strcicmp(temp, car) == 0)
{
confignum = j;
@ -224,6 +227,12 @@ int getconfigtouse(const char* config_file_str, char* car, int sim)
slogt("matched default car");
confignum = j;
}
}
else
{
slogt("assuming default car");
confignum = j;
}
if(confignum<configs-1)
{
break;