From 156a06e4958b1550dc8448556730e80b8b551289 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 12 May 2012 08:23:37 +0200 Subject: [PATCH] =?UTF-8?q?i3bar:=20Don=E2=80=99t=20crash=20when=20full=5F?= =?UTF-8?q?text=20is=20missing=20or=20null=20in=20the=20JSON=20input=20(Th?= =?UTF-8?q?anks=20fernandotcl)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i3bar/src/child.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/i3bar/src/child.c b/i3bar/src/child.c index 0b6f07df..c2be484b 100644 --- a/i3bar/src/child.c +++ b/i3bar/src/child.c @@ -128,6 +128,10 @@ static int stdin_end_map(void *context) { parser_ctx *ctx = context; struct status_block *new_block = smalloc(sizeof(struct status_block)); memcpy(new_block, &(ctx->block), sizeof(struct status_block)); + /* Ensure we have a full_text set, so that when it is missing (or null), + * i3bar doesn’t crash and the user gets an annoying message. */ + if (!new_block->full_text) + new_block->full_text = sstrdup("SPEC VIOLATION (null)"); TAILQ_INSERT_TAIL(&statusline_head, new_block, blocks); return 1; }