diff options
Diffstat (limited to 'usr.bin/tmux/cmd-new-session.c')
| -rw-r--r-- | usr.bin/tmux/cmd-new-session.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index 510b956ded7..8e2b6a33aec 100644 --- a/usr.bin/tmux/cmd-new-session.c +++ b/usr.bin/tmux/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-session.c,v 1.112 2018/06/08 09:41:34 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.113 2018/06/08 09:43:58 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -203,9 +203,10 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) } if ((is_control || detached) && args_has(args, 'x')) { tmp = args_get(args, 'x'); - if (strcmp(tmp, "-") == 0) - sx = c->tty.sx; - else { + if (strcmp(tmp, "-") == 0) { + if (c != NULL) + sx = c->tty.sx; + } else { sx = strtonum(tmp, 1, USHRT_MAX, &errstr); if (errstr != NULL) { cmdq_error(item, "width %s", errstr); @@ -215,9 +216,10 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) } if ((is_control || detached) && args_has(args, 'y')) { tmp = args_get(args, 'y'); - if (strcmp(tmp, "-") == 0) - sy = c->tty.sy; - else { + if (strcmp(tmp, "-") == 0) { + if (c != NULL) + sy = c->tty.sy; + } else { sy = strtonum(tmp, 1, USHRT_MAX, &errstr); if (errstr != NULL) { cmdq_error(item, "height %s", errstr); |
