summaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Alex Xu (Hello71) <alex_y_xu@yahoo.ca>2018-05-04 11:10:01 -0400
committerLibravatar Alex Xu (Hello71) <alex_y_xu@yahoo.ca>2018-05-04 11:10:01 -0400
commit3202c45054efd8e1d67b3aa48f5a46fc25a7bb57 (patch)
treed5a9edbf868a0942b6a98582bdeffdbe90abd794 /sway/tree/container.c
parentMerge pull request #1907 from emersion/backend-input-mapping (diff)
downloadsway-3202c45054efd8e1d67b3aa48f5a46fc25a7bb57.tar.gz
sway-3202c45054efd8e1d67b3aa48f5a46fc25a7bb57.tar.zst
sway-3202c45054efd8e1d67b3aa48f5a46fc25a7bb57.zip
Check for NULL in container_update_title
Fixes crash when opening Firefox developer tools.
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c7
1 files changed, 6 insertions, 1 deletions
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,
348 swayc, title, sibling, sibling ? sibling->type : 0, sibling->name); 348 swayc, title, sibling, sibling ? sibling->type : 0, sibling->name);
349 // Setup values 349 // Setup values
350 swayc->sway_view = sway_view; 350 swayc->sway_view = sway_view;
351 container_update_title(swayc, title ? title : ""); 351 container_update_title(swayc, title);
352 swayc->width = 0; 352 swayc->width = 0;
353 swayc->height = 0; 353 swayc->height = 0;
354 354
@@ -660,9 +660,14 @@ static void container_notify_child_title_changed(
660 660
661void container_update_title(struct sway_container *container, 661void container_update_title(struct sway_container *container,
662 const char *new_title) { 662 const char *new_title) {
663 if (!new_title) {
664 new_title = "";
665 }
666
663 if (container->name && strcmp(container->name, new_title) == 0) { 667 if (container->name && strcmp(container->name, new_title) == 0) {
664 return; 668 return;
665 } 669 }
670
666 if (container->name) { 671 if (container->name) {
667 free(container->name); 672 free(container->name);
668 } 673 }