From 197347b61f4f6cfdf0da94aa3d6205e692e5954e Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 5 Jun 2008 22:59:38 +0000 Subject: Don't bork on link/swap the same window. Also extend comment. --- cmd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'cmd.c') diff --git a/cmd.c b/cmd.c index 5ac2874e..6685ef0a 100644 --- a/cmd.c +++ b/cmd.c @@ -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 @@ -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); -- cgit