diff --git a/lib/plat/unix/unix-misc.c b/lib/plat/unix/unix-misc.c index 8dcaaa94c..fce5e4297 100644 --- a/lib/plat/unix/unix-misc.c +++ b/lib/plat/unix/unix-misc.c @@ -127,9 +127,12 @@ lws_plat_ntpclient_config(struct lws_context *context) char *ntpsrv = getenv("LWS_NTP_SERVER"); if (ntpsrv && strlen(ntpsrv) < 64) { - lws_system_blob_direct_set(lws_system_get_blob(context, - LWS_SYSBLOB_TYPE_NTP_SERVER, 0), - (const uint8_t *)ntpsrv, + lws_system_blob_t *blob = lws_system_get_blob(context, + LWS_SYSBLOB_TYPE_NTP_SERVER, 0); + if (!blob) + return 0; + + lws_system_blob_direct_set(blob, (const uint8_t *)ntpsrv, strlen(ntpsrv)); return 1; }