diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-02-21 13:24:13 -0500 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-02-21 21:18:03 +0100 |
commit | d3d7956576341bbbfb60d045175b0e8a44752e0b (patch) | |
tree | 0df81ca066ab77d569baf41623f652b1c7f8a638 /sway/commands/titlebar_border_thickness.c | |
parent | Merge pull request #3743 from RedSoxFan/fix-output-get-active-workspace (diff) | |
download | sway-d3d7956576341bbbfb60d045175b0e8a44752e0b.tar.gz sway-d3d7956576341bbbfb60d045175b0e8a44752e0b.tar.zst sway-d3d7956576341bbbfb60d045175b0e8a44752e0b.zip |
Handle NULL from output_get_active_workspace
This modifies the places where output_get_active_workspace is called to
handle a NULL result. Some places already handled it and did not need a
change, some just have guard off code blocks, others return errors, and
some have sway_asserts since the case should never happen. A lot of this
is probably just safety precautions since they probably will never be
called when `output_get_active_workspace` is not fully configured with a
workspace.
Diffstat (limited to 'sway/commands/titlebar_border_thickness.c')
-rw-r--r-- | sway/commands/titlebar_border_thickness.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sway/commands/titlebar_border_thickness.c b/sway/commands/titlebar_border_thickness.c index 3c5e9ba1..7c27c163 100644 --- a/sway/commands/titlebar_border_thickness.c +++ b/sway/commands/titlebar_border_thickness.c | |||
@@ -21,7 +21,12 @@ struct cmd_results *cmd_titlebar_border_thickness(int argc, char **argv) { | |||
21 | 21 | ||
22 | for (int i = 0; i < root->outputs->length; ++i) { | 22 | for (int i = 0; i < root->outputs->length; ++i) { |
23 | struct sway_output *output = root->outputs->items[i]; | 23 | struct sway_output *output = root->outputs->items[i]; |
24 | arrange_workspace(output_get_active_workspace(output)); | 24 | struct sway_workspace *ws = output_get_active_workspace(output); |
25 | if (!sway_assert(ws, "Expected output to have a workspace")) { | ||
26 | return cmd_results_new(CMD_FAILURE, | ||
27 | "Expected output to have a workspace"); | ||
28 | } | ||
29 | arrange_workspace(ws); | ||
25 | output_damage_whole(output); | 30 | output_damage_whole(output); |
26 | } | 31 | } |
27 | 32 | ||