summary refs log tree commit diff
path: root/menu.c
diff options
context:
space:
mode:
authorokan <okan>2016-04-28 16:28:38 +0000
committerokan <okan>2016-04-28 16:28:38 +0000
commitffc365bc5d1c5dee337a2869fcc728f46dd262a8 (patch)
treeb9d298b8f2fd6a99fa2dca34e89a4a6dbba2e084 /menu.c
parent4ac6daa27ded7927d481810a2350942feef20978 (diff)
downloadcwm-ffc365bc5d1c5dee337a2869fcc728f46dd262a8.tar.gz
cwm-ffc365bc5d1c5dee337a2869fcc728f46dd262a8.tar.xz
cwm-ffc365bc5d1c5dee337a2869fcc728f46dd262a8.zip
If supplied format to menuq_add() is NULL, fill text with an empty
string; found by Christian Neukirchen.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/menu.c b/menu.c
index cb4ee7d..969b2d2 100644
--- a/menu.c
+++ b/menu.c
@@ -601,7 +601,10 @@ menuq_add(struct menu_q *mq, void *ctx, const char *fmt, ...)
 	mi->ctx = ctx;
 
 	va_start(ap, fmt);
-	(void)vsnprintf(mi->text, sizeof(mi->text), fmt, ap);
+	if (fmt != NULL)
+		(void)vsnprintf(mi->text, sizeof(mi->text), fmt, ap);
+	else
+		mi->text[0] = '\0';
 	va_end(ap);
 
 	TAILQ_INSERT_TAIL(mq, mi, entry);