diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-05 22:59:38 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-05 22:59:38 +0000 |
commit | 197347b61f4f6cfdf0da94aa3d6205e692e5954e (patch) | |
tree | e64882c3fe2a781d76d4e4545c1fc80efbcaea3b /cmd.c | |
parent | 741f8967b40121f0364c90635bd609df9cdcd933 (diff) | |
download | rtmux-197347b61f4f6cfdf0da94aa3d6205e692e5954e.tar.gz rtmux-197347b61f4f6cfdf0da94aa3d6205e692e5954e.tar.bz2 rtmux-197347b61f4f6cfdf0da94aa3d6205e692e5954e.zip |
Don't bork on link/swap the same window. Also extend comment.
Diffstat (limited to 'cmd.c')
-rw-r--r-- | cmd.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1,4 +1,4 @@ -/* $Id: cmd.c,v 1.43 2008-06-05 21:25:00 nicm Exp $ */ +/* $Id: cmd.c,v 1.44 2008-06-05 22:59:38 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -313,14 +313,15 @@ cmd_find_window(struct cmd_ctx *ctx, const char *arg, struct session **sp) s = ctx->cursession; if (s == NULL) s = cmd_current_session(ctx); - if (s != NULL) { - if (idx == -1) - wl = s->curw; - else - wl = winlink_find_by_index(&s->windows, idx); - } + if (s == NULL) + return (NULL); if (sp != NULL) *sp = s; + + if (idx == -1) + wl = s->curw; + else + wl = winlink_find_by_index(&s->windows, idx); if (wl == NULL) ctx->error(ctx, "window not found: %s:%d", s->name, idx); return (wl); |