From: Timo Sirainen Date: Sun, 29 Apr 2018 09:17:45 +0000 (+0300) Subject: lib: event_add_str() - Ignore calls when value is NULL X-Git-Tag: 2.3.9~1835 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b072b9b3a0bc17023feb2073090bc2db5bce9d72;p=thirdparty%2Fdovecot%2Fcore.git lib: event_add_str() - Ignore calls when value is NULL Alternative could be to assert-crash instead. But perhaps this makes it easier to use and avoids unnecessary assert-crashes? --- diff --git a/src/lib/lib-event.c b/src/lib/lib-event.c index a5e10b9db8..b1b6483fd1 100644 --- a/src/lib/lib-event.c +++ b/src/lib/lib-event.c @@ -392,6 +392,11 @@ event_add_str(struct event *event, const char *key, const char *value) { struct event_field *field; + if (value == NULL) { + /* silently ignoring is perhaps better than assert-crashing? */ + return event; + } + field = event_get_field(event, key); field->value_type = EVENT_FIELD_VALUE_TYPE_STR; i_zero(&field->value);