aboutsummaryrefslogtreecommitdiff
path: root/sway/commands.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-09-01 12:56:35 -0400
committerDrew DeVault <sir@cmpwn.com>2015-09-01 12:56:35 -0400
commit569c6710a976f92518754c6f7fe2840caa9edda2 (patch)
tree810e78292b6bf80337af70200f6ae55a2579e80d /sway/commands.c
parent9eb5ba49614d5934108dc4da18419b033c976e5b (diff)
parent972748e674918dea00533ef895748577dfb7759b (diff)
downloadsway-569c6710a976f92518754c6f7fe2840caa9edda2.tar.xz
Merge pull request #160 from taiyu-len/master
cleaned up leaky prev_workspace_name
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 177c54ab..6e74a442 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -822,11 +822,8 @@ static bool cmd_workspace(struct sway_config *config, int argc, char **argv) {
}
if (strcasecmp(argv[0], "back_and_forth") == 0) {
if (prev_workspace_name) {
- if (workspace_by_name(prev_workspace_name)) {
- workspace_switch(workspace_by_name(prev_workspace_name));
- } else {
- workspace_switch(workspace_create(prev_workspace_name));
- }
+ swayc_t *ws = workspace_by_name(prev_workspace_name);
+ workspace_switch(ws ? ws : workspace_create(prev_workspace_name));
}
return true;
}