From: Timo Sirainen Date: Thu, 27 Apr 2017 09:50:13 +0000 (+0300) Subject: lib-index: mail_index_update_keywords() - don't assert if adding/removing 0 keywords X-Git-Tag: 2.3.0.rc1~1686 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb1203abda86ebc369a41841b83751b3ee5f27a7;p=thirdparty%2Fdovecot%2Fcore.git lib-index: mail_index_update_keywords() - don't assert if adding/removing 0 keywords Although it would be nice for the caller to check it, it's easier to do here. It's mainly a problem with mailbox_keywords_create_valid() that may unexpectedly create empty keywords. --- diff --git a/src/lib-index/mail-index-transaction-update.c b/src/lib-index/mail-index-transaction-update.c index 9fbeca4475..8b0047af1e 100644 --- a/src/lib-index/mail-index-transaction-update.c +++ b/src/lib-index/mail-index-transaction-update.c @@ -1156,9 +1156,11 @@ void mail_index_update_keywords(struct mail_index_transaction *t, uint32_t seq, i_assert(seq > 0 && (seq <= mail_index_view_get_messages_count(t->view) || seq <= t->last_new_seq)); - i_assert(keywords->count > 0 || modify_type == MODIFY_REPLACE); i_assert(keywords->index == t->view->index); + if (keywords->count == 0 && modify_type != MODIFY_REPLACE) + return; + update_minmax_flagupdate_seq(t, seq, seq); if (!array_is_created(&t->keyword_updates)) {