From 0848844f2d41055f6ffc69af1149d7a873460976 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 24 Aug 2011 00:55:11 +0200 Subject: [PATCH 1/2] Bugfix: Fix 'focus mode_toggle' on an empty workspace (Thanks BeF) Fixes #487 --- src/cmdparse.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmdparse.y b/src/cmdparse.y index 9b63ff0c..d271c997 100644 --- a/src/cmdparse.y +++ b/src/cmdparse.y @@ -484,7 +484,7 @@ focus: int to_focus = $2; if ($2 == TOK_MODE_TOGGLE) { current = TAILQ_FIRST(&(ws->focus_head)); - if (current->type == CT_FLOATING_CON) + if (current != NULL && current->type == CT_FLOATING_CON) to_focus = TOK_TILING; else to_focus = TOK_FLOATING; } From b8a656bca70522325b95f8a80d74324bb35ff10b Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 24 Aug 2011 00:56:28 +0200 Subject: [PATCH 2/2] Add test for the 'focus mode_toggle' issue (#487) --- testcases/t/74-regress-focus-toggle.t | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 testcases/t/74-regress-focus-toggle.t diff --git a/testcases/t/74-regress-focus-toggle.t b/testcases/t/74-regress-focus-toggle.t new file mode 100644 index 00000000..469d1be8 --- /dev/null +++ b/testcases/t/74-regress-focus-toggle.t @@ -0,0 +1,17 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Regression: Checks if i3 still lives after using 'focus mode_toggle' on an +# empty workspace. This regression was fixed in +# 0848844f2d41055f6ffc69af1149d7a873460976. +# +use i3test; +use v5.10; + +my $tmp = fresh_workspace; + +cmd 'focus mode_toggle'; + +does_i3_live; + +done_testing;