mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
Check if cfg actually exists before trying to parse logging
This commit is contained in:
parent
84f85e137d
commit
a2ee85bd52
1 changed files with 9 additions and 7 deletions
|
@ -37,14 +37,16 @@ int log_parse_wrapper(struct log *l, json_t *cfg)
|
|||
json_t *json_logging = NULL;
|
||||
json_error_t err;
|
||||
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{s?: o}",
|
||||
"logging", &json_logging
|
||||
);
|
||||
if (ret)
|
||||
jerror(&err, "Failed to parse global configuration");
|
||||
if(cfg) {
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{s?: o}",
|
||||
"logging", &json_logging
|
||||
);
|
||||
if (ret)
|
||||
jerror(&err, "Failed to parse logging from global configuration");
|
||||
|
||||
if(json_logging)
|
||||
log_parse(l, json_logging);
|
||||
if(json_logging)
|
||||
log_parse(l, json_logging);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue