diff --git a/cmd-run-shell.c b/cmd-run-shell.c index db5774d2..560eface 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -84,7 +84,7 @@ cmd_run_shell_print(struct job *job, const char *msg) if (cdata->wp_id != -1) wp = window_pane_find_by_id(cdata->wp_id); - if (wp == NULL && cdata->item != NULL) + if (wp == NULL && cdata->item != NULL && cdata->client != NULL) wp = server_client_get_pane(cdata->client); if (wp == NULL && cmd_find_from_nothing(&fs, 0) == 0) wp = fs.wp; diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c index 9112683f..c9ffe5ed 100644 --- a/cmd-set-buffer.c +++ b/cmd-set-buffer.c @@ -69,8 +69,13 @@ cmd_set_buffer_exec(struct cmd *self, struct cmdq_item *item) pb = paste_get_name(bufname); if (cmd_get_entry(self) == &cmd_delete_buffer_entry) { - if (pb == NULL) + if (pb == NULL) { + if (bufname != NULL) { + cmdq_error(item, "unknown buffer: %s", bufname); + return (CMD_RETURN_ERROR); + } pb = paste_get_top(&bufname); + } if (pb == NULL) { cmdq_error(item, "no buffer"); return (CMD_RETURN_ERROR); @@ -80,8 +85,13 @@ cmd_set_buffer_exec(struct cmd *self, struct cmdq_item *item) } if (args_has(args, 'n')) { - if (pb == NULL) + if (pb == NULL) { + if (bufname != NULL) { + cmdq_error(item, "unknown buffer: %s", bufname); + return (CMD_RETURN_ERROR); + } pb = paste_get_top(&bufname); + } if (pb == NULL) { cmdq_error(item, "no buffer"); return (CMD_RETURN_ERROR);