summaryrefslogtreecommitdiffstats
path: root/cmd-find.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2018-05-03 19:02:26 +0100
committerThomas Adam <thomas@xteddy.org>2018-05-03 19:02:26 +0100
commit1d858aa89eecae2a4aa6021650216ca9fce8ba25 (patch)
tree5d2f91e582da67035af9dbd34b82ed22bc3223b4 /cmd-find.c
parent645fe9013fdddf54ccc66df8a4477604f293a4f6 (diff)
parente24a077752106189e932be29eb71fe7fc40089b6 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-find.c')
-rw-r--r--cmd-find.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/cmd-find.c b/cmd-find.c
index b727b245..87ca7310 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -436,15 +436,15 @@ cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window)
if (window[0] != '+' && window[0] != '-') {
idx = strtonum(window, 0, INT_MAX, &errstr);
if (errstr == NULL) {
- if (fs->flags & CMD_FIND_WINDOW_INDEX) {
- fs->idx = idx;
- return (0);
- }
fs->wl = winlink_find_by_index(&fs->s->windows, idx);
if (fs->wl != NULL) {
fs->w = fs->wl->window;
return (0);
}
+ if (fs->flags & CMD_FIND_WINDOW_INDEX) {
+ fs->idx = idx;
+ return (0);
+ }
}
}
@@ -1181,7 +1181,8 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
/* This will fill in session, winlink and window. */
if (cmd_find_get_window(fs, window, window_only) != 0)
goto no_window;
- fs->wp = fs->wl->window->active;
+ if (fs->wl != NULL) /* can be NULL if index only */
+ fs->wp = fs->wl->window->active;
goto found;
}