gluon-respondd: allow platforminfo_get_model() to return NULL

This commit is contained in:
Matthias Schiffer 2017-02-12 06:04:22 +01:00
parent 31ee7be16d
commit afdae86a5e
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
1 changed files with 5 additions and 1 deletions

View File

@ -99,7 +99,11 @@ static struct json_object * respondd_provider_nodeinfo(void) {
json_object_object_add(ret, "hostname", get_hostname());
struct json_object *hardware = json_object_new_object();
json_object_object_add(hardware, "model", json_object_new_string(platforminfo_get_model()));
const char *model = platforminfo_get_model();
if (model)
json_object_object_add(hardware, "model", json_object_new_string(model));
json_object_object_add(hardware, "nproc", json_object_new_int(sysconf(_SC_NPROCESSORS_ONLN)));
json_object_object_add(ret, "hardware", hardware);