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

pull/2001/head
nicm 2019-11-28 21:18:38 +00:00 committed by Nicholas Marriott
parent 640149337f
commit ad98fad9a3
1 changed files with 3 additions and 4 deletions

View File

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