Fix agent crash when archived host has not been registered to the cloud (#13437)
If archived host has no node id, do not crash
Stelios Fragkakis committed
Jul 27, 2022 at 13:48 UTC
50bf6c18b4354c25404e9143a5ad11f67278287f
1 file changed
+4
-1
database/sqlite/sqlite_aclk.c
+4
-1
@@ -313,9 +313,12 @@ static int create_host_callback(void *data, int argc, char **argv, char **column
313
, system_info
314
, 1
315
);
316
+#ifdef NETDATA_INTERNAL_CHECKS
317
char node_str[UUID_STR_LEN] = "<none>";
317
- uuid_unparse_lower(*host->node_id, node_str);
318
+ if (likely(host->node_id))
319
+ uuid_unparse_lower(*host->node_id, node_str);
320
internal_error(true, "Adding archived host \"%s\" with GUID \"%s\" node id = \"%s\"", host->hostname, host->machine_guid, node_str);
321
+#endif
322
return 0;
323
}
324
#endif