1
0
Fork 0
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:
Dennis Potter 2018-07-19 15:25:46 +02:00
parent 84f85e137d
commit a2ee85bd52

View file

@ -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;
}