Skip to content

Commit

Permalink
workspace_create: Don't allow NULL name
Browse files Browse the repository at this point in the history
  • Loading branch information
Nefsen402 authored and emersion committed Nov 11, 2022
1 parent fdde674 commit 34933bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sway/tree/workspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ struct sway_output *workspace_get_initial_output(const char *name) {

struct sway_workspace *workspace_create(struct sway_output *output,
const char *name) {
sway_assert(name, "NULL name given to workspace_create");

if (output == NULL) {
output = workspace_get_initial_output(name);
}
Expand All @@ -69,7 +71,7 @@ struct sway_workspace *workspace_create(struct sway_output *output,
return NULL;
}
node_init(&ws->node, N_WORKSPACE, ws);
ws->name = name ? strdup(name) : NULL;
ws->name = strdup(name);
ws->prev_split_layout = L_NONE;
ws->layout = output_get_default_layout(output);
ws->floating = create_list();
Expand Down

0 comments on commit 34933bb

Please sign in to comment.