summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-10-10 20:51:55 -0400
committerDrew DeVault <sir@cmpwn.com>2016-10-12 21:43:34 -0400
commit31d7684f17a2260fe78a877daca5330bf3074224 (patch)
tree0d46d27a0aeaa2f57f42f3eccb106b31400f5546
parent0af3196d0ee3fe37ce4e88808979a80cfde2ea1b (diff)
Merge pull request #947 from alkino/fix_move_empty_workspace0.10-rc3
Can't move an empty workspace
-rw-r--r--sway/commands/move.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 5b97897ad..48e9d562d 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -34,6 +34,9 @@ struct cmd_results *cmd_move(int argc, char **argv) {
} else if (strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "workspace") == 0) {
// move container to workspace x
if (view->type == C_WORKSPACE) {
+ if (!view->children || view->children->length == 0) {
+ return cmd_results_new(CMD_FAILURE, "move", "Cannot move an empty workspace");
+ }
view = new_container(view, view->layout);
} if (view->type != C_CONTAINER && view->type != C_VIEW) {
return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views.");
@@ -59,6 +62,9 @@ struct cmd_results *cmd_move(int argc, char **argv) {
struct wlc_point abs_pos;
get_absolute_center_position(view, &abs_pos);
if (view->type == C_WORKSPACE) {
+ if (!view->children || view->children->length == 0) {
+ return cmd_results_new(CMD_FAILURE, "move", "Cannot move an empty workspace");
+ }
view = new_container(view, view->layout);
} else if (view->type != C_CONTAINER && view->type != C_VIEW) {
return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views.");