mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 00:05:40 +02:00
tag: fix crash on empty tag specifier, “{}”
For strings with empty tag specifiers, “{}”, we ended up calling tag_for_name() with a NULL pointer for name. This caused us to crash. Closes #48
This commit is contained in:
parent
cb45e53cb4
commit
5c4ae642f2
2 changed files with 5 additions and 2 deletions
5
tag.c
5
tag.c
|
@ -446,8 +446,9 @@ tags_expand_template(const char *template, const struct tag_set *tags)
|
|||
}
|
||||
|
||||
/* Lookup tag */
|
||||
const struct tag *tag = tag_for_name(tags, tag_name);
|
||||
if (tag == NULL) {
|
||||
const struct tag *tag = NULL;
|
||||
|
||||
if (tag_name == NULL || (tag = tag_for_name(tags, tag_name)) == NULL) {
|
||||
/* No such tag, copy as-is instead */
|
||||
sbuf_append_at_most(&formatted, template, begin - template + 1);
|
||||
template = begin + 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue