From 998dcb9cc9ea38ee48a374502f990ee7acfca439 Mon Sep 17 00:00:00 2001 From: "Deomid \"rojer\" Ryabkov" Date: Wed, 22 Jan 2020 12:09:08 +0000 Subject: [PATCH] Check config for NULL before checking if it's enabled Fixes https://github.com/mongoose-os-libs/mqtt/issues/15 --- src/mgos_mqtt_conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mgos_mqtt_conn.c b/src/mgos_mqtt_conn.c index 6961d4a..5437256 100644 --- a/src/mgos_mqtt_conn.c +++ b/src/mgos_mqtt_conn.c @@ -479,7 +479,7 @@ static void mqtt_switch_config(struct mgos_mqtt_conn *c) { /* User set a custom config - don't mess with it. */ return; } - if (cfg->enable) { + if (cfg != NULL && cfg->enable) { c->cfg = cfg; c->reconnect_timeout_ms = cfg->reconnect_timeout_min * 1000; }