Explorar o código

gluon-respondd: allow platforminfo_get_model() to return NULL

Matthias Schiffer %!s(int64=7) %!d(string=hai) anos
pai
achega
afdae86a5e
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      package/gluon-respondd/src/respondd.c

+ 5 - 1
package/gluon-respondd/src/respondd.c

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