aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
authorLibravatar Dominique Martinet <asmadeus@codewreck.org>2018-06-30 22:39:37 +0900
committerLibravatar Dominique Martinet <asmadeus@codewreck.org>2018-07-02 08:03:41 +0900
commit9c9ee3e4ef9d4e57ec801a79e0b2da1bd2a6d46e (patch)
tree9156cb10cbc718735ff70571a44a8ca1f457dd46 /sway/tree/workspace.c
parentoutput commands: move !argc checks after argc gets decremented (diff)
downloadsway-9c9ee3e4ef9d4e57ec801a79e0b2da1bd2a6d46e.tar.gz
sway-9c9ee3e4ef9d4e57ec801a79e0b2da1bd2a6d46e.tar.zst
sway-9c9ee3e4ef9d4e57ec801a79e0b2da1bd2a6d46e.zip
find prev/next output/workspace: add NULL check
These could be called with NULL if there is no focus Found through static analysis.
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 5eb4be0f..3a311cd1 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -271,6 +271,9 @@ struct sway_container *workspace_by_name(const char *name) {
271 */ 271 */
272struct sway_container *workspace_output_prev_next_impl( 272struct sway_container *workspace_output_prev_next_impl(
273 struct sway_container *output, bool next) { 273 struct sway_container *output, bool next) {
274 if (!output) {
275 return NULL;
276 }
274 if (!sway_assert(output->type == C_OUTPUT, 277 if (!sway_assert(output->type == C_OUTPUT,
275 "Argument must be an output, is %d", output->type)) { 278 "Argument must be an output, is %d", output->type)) {
276 return NULL; 279 return NULL;
@@ -303,6 +306,9 @@ struct sway_container *workspace_output_prev_next_impl(
303 */ 306 */
304struct sway_container *workspace_prev_next_impl( 307struct sway_container *workspace_prev_next_impl(
305 struct sway_container *workspace, bool next) { 308 struct sway_container *workspace, bool next) {
309 if (!workspace) {
310 return NULL;
311 }
306 if (!sway_assert(workspace->type == C_WORKSPACE, 312 if (!sway_assert(workspace->type == C_WORKSPACE,
307 "Argument must be a workspace, is %d", workspace->type)) { 313 "Argument must be a workspace, is %d", workspace->type)) {
308 return NULL; 314 return NULL;