cleaned up leaky prev_workspace_name

This commit is contained in:
taiyu 2015-09-01 09:02:26 -07:00
parent 9eb5ba4961
commit 972748e674
2 changed files with 15 additions and 13 deletions

View file

@ -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;
}