lib/config: make sure the config map exists when loading defaults

We should not rely on one of the other "_notmuch_config_load_*"
functions being called before this one.
This commit is contained in:
David Bremner 2021-12-25 09:33:04 -04:00
parent 63b4c46983
commit 64212c7b91

View file

@ -658,6 +658,9 @@ _notmuch_config_load_defaults (notmuch_database_t *notmuch)
{ {
notmuch_config_key_t key; notmuch_config_key_t key;
if (notmuch->config == NULL)
notmuch->config = _notmuch_string_map_create (notmuch);
for (key = NOTMUCH_CONFIG_FIRST; for (key = NOTMUCH_CONFIG_FIRST;
key < NOTMUCH_CONFIG_LAST; key < NOTMUCH_CONFIG_LAST;
key = notmuch_config_key_t (key + 1)) { key = notmuch_config_key_t (key + 1)) {