summaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-06-18 09:20:19 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-06-18 09:20:19 +0000
commita4a2c68fa9428cc3ceb9c9630f4d54b9b91bf043 (patch)
tree48689e84f7d005f68cc8cd612559a0acaa7fe94f /cmd.c
parent2113115cdd554065c760ee2de8bf2790c541edf3 (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 'cmd.c')
-rw-r--r--cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd.c b/cmd.c
index a3a70284..16758589 100644
--- a/cmd.c
+++ b/cmd.c
@@ -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);