Added more robustness to config lookup
This commit is contained in:
parent
9e09a2792a
commit
d1629dfcbd
|
|
@ -214,14 +214,23 @@ 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;
|
||||||
found = config_setting_lookup_string(config_config, "car", &temp);
|
found = config_setting_lookup_string(config_config, "car", &temp);
|
||||||
if(strcicmp(temp, car) == 0)
|
if(temp != NULL && found > 0)
|
||||||
{
|
{
|
||||||
confignum = j;
|
if(strcicmp(temp, car) == 0)
|
||||||
|
{
|
||||||
|
confignum = j;
|
||||||
|
}
|
||||||
|
if(strcicmp("default", temp) == 0)
|
||||||
|
{
|
||||||
|
slogt("matched default car");
|
||||||
|
confignum = j;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(strcicmp("default", temp) == 0)
|
else
|
||||||
{
|
{
|
||||||
slogt("matched default car");
|
slogt("assuming default car");
|
||||||
confignum = j;
|
confignum = j;
|
||||||
}
|
}
|
||||||
if(confignum<configs-1)
|
if(confignum<configs-1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue