aboutsummaryrefslogtreecommitdiff
path: root/cmd-if-shell.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2013-03-11 21:31:46 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2013-03-11 21:31:46 +0000
commit543420ccd2c3c23437405b391e3f9fe1d05223f7 (patch)
tree7581f8eb90cd26fd51c5e406f31f561e0e4eb603 /cmd-if-shell.c
parent064022548bcbf4d45705fdbff8441f2b5da5f682 (diff)
parent7c009509676b4580065fdc6f0084a93b9758fac0 (diff)
downloadrtmux-543420ccd2c3c23437405b391e3f9fe1d05223f7.tar.gz
rtmux-543420ccd2c3c23437405b391e3f9fe1d05223f7.tar.bz2
rtmux-543420ccd2c3c23437405b391e3f9fe1d05223f7.zip
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
Diffstat (limited to 'cmd-if-shell.c')
-rw-r--r--cmd-if-shell.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/cmd-if-shell.c b/cmd-if-shell.c
index b921f418..b22e3269 100644
--- a/cmd-if-shell.c
+++ b/cmd-if-shell.c
@@ -59,19 +59,21 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
struct args *args = self->args;
struct cmd_if_shell_data *cdata;
char *shellcmd;
- struct session *s;
- struct winlink *wl;
- struct window_pane *wp;
+ struct session *s = NULL;
+ struct winlink *wl = NULL;
+ struct window_pane *wp = NULL;
struct format_tree *ft;
- wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp);
- if (wl == NULL)
- return (CMD_RETURN_ERROR);
+ if (args_has(args, 't'))
+ wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp);
ft = format_create();
- format_session(ft, s);
- format_winlink(ft, s, wl);
- format_window_pane(ft, wp);
+ if (s != NULL)
+ format_session(ft, s);
+ if (s != NULL && wl != NULL)
+ format_winlink(ft, s, wl);
+ if (wp != NULL)
+ format_window_pane(ft, wp);
shellcmd = format_expand(ft, args->argv[0]);
format_free(ft);