diff --git a/sway/commands/ipc.c b/sway/commands/ipc.c index e2bca2a691..1d6143afff 100644 --- a/sway/commands/ipc.c +++ b/sway/commands/ipc.c @@ -18,13 +18,6 @@ struct cmd_results *cmd_ipc(int argc, char **argv) { if ((error = check_security_config())) { return error; } - - char *program = NULL; - - if (!(program = resolve_ipc_path(argv[0]))) { - return cmd_results_new( - CMD_FAILURE, "ipc", "Memory allocation error occured."); - } if (config->reading && strcmp("{", argv[1]) != 0) { return cmd_results_new(CMD_INVALID, "ipc", "Expected '{' at start of IPC config definition."); @@ -34,6 +27,12 @@ struct cmd_results *cmd_ipc(int argc, char **argv) { return cmd_results_new(CMD_FAILURE, "ipc", "Can only be used in config file."); } + char *program = NULL; + + if (!(program = resolve_ipc_path(argv[0]))) { + return cmd_results_new( + CMD_FAILURE, "ipc", "Memory allocation error occured."); + } current_policy = alloc_ipc_policy(program); list_add(config->ipc_policies, current_policy);