improve stability of config file loading when multiple configs are in use

This commit is contained in:
Paul Dino Jones 2024-11-22 16:21:30 -05:00
parent 7caca1d362
commit c1375ae0c9
1 changed files with 4 additions and 1 deletions

View File

@ -256,8 +256,10 @@ int getconfigtouse(const char* config_file_str, char* car, int sim)
slogt("checking if car is matched %i", j); slogt("checking if car is matched %i", j);
temp = NULL; temp = NULL;
found = config_setting_lookup_string(config_config, "car", &temp); found = config_setting_lookup_string(config_config, "car", &temp);
if(temp != NULL && found > 0 && car != NULL) slogt("config car is %s found is %i", temp, found);
if(temp != NULL && found > 0 && car > 0 && car != NULL)
{ {
slogt("checking against sim car of %s", car);
if(strcicmp(temp, car) == 0) if(strcicmp(temp, car) == 0)
{ {
confignum = j; confignum = j;
@ -273,6 +275,7 @@ int getconfigtouse(const char* config_file_str, char* car, int sim)
slogt("assuming default car"); slogt("assuming default car");
confignum = j; confignum = j;
} }
slogt("bomb");
if(confignum<configs-1) if(confignum<configs-1)
{ {
break; break;