openbsd-ports/x11/i3/patches/patch-i3bar_src_child_c
dcoppa bed5ec15d9 i3bar: Don't crash when full_text is missing or null in the JSON input
(upstream git commit 156a06e4958b1550dc8448556730e80b8b551289)
2012-05-14 07:47:05 +00:00

21 lines
976 B
Plaintext

$OpenBSD: patch-i3bar_src_child_c,v 1.4 2012/05/14 07:47:05 dcoppa Exp $
From 156a06e4958b1550dc8448556730e80b8b551289 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Sat, 12 May 2012 06:23:37 +0000
Subject: i3bar: Don't crash when full_text is missing or null in the JSON input
--- i3bar/src/child.c.orig Wed Apr 25 23:21:25 2012
+++ i3bar/src/child.c Mon May 14 09:32:12 2012
@@ -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;
}