mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 13:37:12 +00:00
Do not try to use the client if the item containing it is NULL.
This commit is contained in:
22
cmd-find.c
22
cmd-find.c
@ -1231,29 +1231,31 @@ no_pane:
|
|||||||
static struct client *
|
static struct client *
|
||||||
cmd_find_current_client(struct cmdq_item *item, int quiet)
|
cmd_find_current_client(struct cmdq_item *item, int quiet)
|
||||||
{
|
{
|
||||||
struct client *c;
|
struct client *c = NULL, *found;
|
||||||
struct session *s;
|
struct session *s;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
struct cmd_find_state fs;
|
struct cmd_find_state fs;
|
||||||
|
|
||||||
if (item->client != NULL && item->client->session != NULL)
|
if (item != NULL)
|
||||||
return (item->client);
|
c = item->client;
|
||||||
|
if (c != NULL && c->session != NULL)
|
||||||
|
return (c);
|
||||||
|
|
||||||
c = NULL;
|
found = NULL;
|
||||||
if ((wp = cmd_find_inside_pane(item->client)) != NULL) {
|
if (c != NULL && (wp = cmd_find_inside_pane(c)) != NULL) {
|
||||||
cmd_find_clear_state(&fs, CMD_FIND_QUIET);
|
cmd_find_clear_state(&fs, CMD_FIND_QUIET);
|
||||||
fs.w = wp->window;
|
fs.w = wp->window;
|
||||||
if (cmd_find_best_session_with_window(&fs) == 0)
|
if (cmd_find_best_session_with_window(&fs) == 0)
|
||||||
c = cmd_find_best_client(fs.s);
|
found = cmd_find_best_client(fs.s);
|
||||||
} else {
|
} else {
|
||||||
s = cmd_find_best_session(NULL, 0, CMD_FIND_QUIET);
|
s = cmd_find_best_session(NULL, 0, CMD_FIND_QUIET);
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
c = cmd_find_best_client(s);
|
found = cmd_find_best_client(s);
|
||||||
}
|
}
|
||||||
if (c == NULL && !quiet)
|
if (found == NULL && item != NULL && !quiet)
|
||||||
cmdq_error(item, "no current client");
|
cmdq_error(item, "no current client");
|
||||||
log_debug("%s: no target, return %p", __func__, c);
|
log_debug("%s: no target, return %p", __func__, found);
|
||||||
return (c);
|
return (found);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the target client or report an error and return NULL. */
|
/* Find the target client or report an error and return NULL. */
|
||||||
|
Reference in New Issue
Block a user