From 3202c45054efd8e1d67b3aa48f5a46fc25a7bb57 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Fri, 4 May 2018 11:10:01 -0400 Subject: Check for NULL in container_update_title Fixes crash when opening Firefox developer tools. --- sway/tree/container.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sway/tree/container.c b/sway/tree/container.c index 3ec58a5d..3746ad81 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -348,7 +348,7 @@ struct sway_container *container_view_create(struct sway_container *sibling, swayc, title, sibling, sibling ? sibling->type : 0, sibling->name); // Setup values swayc->sway_view = sway_view; - container_update_title(swayc, title ? title : ""); + container_update_title(swayc, title); swayc->width = 0; swayc->height = 0; @@ -660,9 +660,14 @@ static void container_notify_child_title_changed( void container_update_title(struct sway_container *container, const char *new_title) { + if (!new_title) { + new_title = ""; + } + if (container->name && strcmp(container->name, new_title) == 0) { return; } + if (container->name) { free(container->name); } -- cgit v1.2.3-54-g00ecf