commit 83882acf57a57736363527c924f0f39045c77456
parent 0515324f23be0bd64346f672344e9312926bc99d
Author: hhvn <dev@hhvn.uk>
Date: Sun, 28 Nov 2021 18:51:01 +0000
ui.c: if variable is set NULL, don't print anything
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ui.c b/ui.c
@@ -866,8 +866,9 @@ ui_format(char *format, struct History *hist) {
}
for (i=0; subs[i].name; i++) {
- if (subs[i].val && strcmp_n(subs[i].name, tmp) == 0) {
- rc += snprintf(&ret[rc], sizeof(ret) - rc, "%s", subs[i].val);
+ if (strcmp_n(subs[i].name, tmp) == 0) {
+ if (subs[i].val)
+ rc += snprintf(&ret[rc], sizeof(ret) - rc, "%s", subs[i].val);
format = strchr(format, '}') + 1;
continue;
}