Do not crash when a format doesn't exist, reported by Thomas Sattler.

This commit is contained in:
nicm 2019-11-28 21:18:38 +00:00
parent fa409194d3
commit c5d74b1deb

View File

@ -1112,11 +1112,10 @@ format_find(struct format_tree *ft, const char *key, int modifiers)
xasprintf(&found, "%lld", (long long)fe->t); xasprintf(&found, "%lld", (long long)fe->t);
goto found; goto found;
} }
if (fe->value == NULL && fe->cb != NULL) { if (fe->value == NULL && fe->cb != NULL)
fe->cb(ft, fe); fe->cb(ft, fe);
if (fe->value == NULL) if (fe->value == NULL)
fe->value = xstrdup(""); fe->value = xstrdup("");
}
found = xstrdup(fe->value); found = xstrdup(fe->value);
goto found; goto found;
} }