diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-06-18 09:20:20 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-06-18 09:20:20 +0000 |
commit | 93ccc614b79c4c7a2aeb961d1df7e4dbc4a3d5d4 (patch) | |
tree | 1dcf7e844e49c288f413ccf6a4a02e9393f4f210 /usr.bin/tmux/cmd.c | |
parent | 882563f92e4625c9c92efeaee641ae9ef9d730b8 (diff) |
Do not crash when the current session has no window, fixes a bug
reported by Giorgio Lando. Fix from Thomas Adam.
Diffstat (limited to 'usr.bin/tmux/cmd.c')
-rw-r--r-- | usr.bin/tmux/cmd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index 3c7c6c64a6e..d69b2f6a660 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.65 2012/04/23 22:43:09 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.66 2012/06/18 09:20:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1290,7 +1290,7 @@ cmd_get_default_path(struct cmd_ctx *ctx, const char *cwd) /* Session working directory. */ root = s->cwd; goto complete_path; - } else if (cwd[0] == '.' && (cwd[1] == '\0' || cwd[1] == '/')){ + } else if (cwd[0] == '.' && (cwd[1] == '\0' || cwd[1] == '/')) { /* Server working directory. */ if (getcwd(tmp, sizeof tmp) != NULL) { root = tmp; @@ -1304,7 +1304,7 @@ cmd_get_default_path(struct cmd_ctx *ctx, const char *cwd) /* Empty or relative path. */ if (ctx->cmdclient != NULL && ctx->cmdclient->cwd != NULL) root = ctx->cmdclient->cwd; - else if (ctx->curclient != NULL) + else if (ctx->curclient != NULL && s->curw != NULL) root = get_proc_cwd(s->curw->window->active->pid); else return (s->cwd); |