diff --git a/ChangeLog.txt b/ChangeLog.txt index 0d7b3df0..a3ab2ebe 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,11 @@ +2.0.19 - 2023-11-xx +=================== + +Broker: +- Fix assert failure when loading a persistence file that contains + subscriptions with no client id. + + 2.0.18 - 2023-09-18 =================== diff --git a/src/persist_read.c b/src/persist_read.c index 14a2f4f0..47deb5b6 100644 --- a/src/persist_read.c +++ b/src/persist_read.c @@ -547,8 +547,14 @@ static int persist__restore_sub(const char *client_id, const char *sub, uint8_t { struct mosquitto *context; - assert(client_id); - assert(sub); + if(!client_id){ + log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Persistence found a subscription with no client id, ignoring."); + return MOSQ_ERR_SUCCESS; + } + if(!sub){ + log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Persistence found a subscription with no topic filter, ignoring."); + return MOSQ_ERR_SUCCESS; + } context = persist__find_or_add_context(client_id, 0); if(!context) return 1;