Skip to content

Commit

Permalink
Check config for NULL before checking if it's enabled
Browse files Browse the repository at this point in the history
Fixes #15
  • Loading branch information
rojer committed Jan 22, 2020
1 parent f43cd39 commit 998dcb9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/mgos_mqtt_conn.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 998dcb9

Please sign in to comment.