aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-06-18 15:14:48 +0000
committerTiago Cunha <tcunha@gmx.com>2012-06-18 15:14:48 +0000
commit2a36a0a06763416ad67be9ffdec0f19b1cc5a92e (patch)
tree93087c86ce43c6ec4d35c0f63ad6ab4d2bfef73f
parent1c15848c479e682ba5e7c3c8446650d2ad00f251 (diff)
downloadrtmux-2a36a0a06763416ad67be9ffdec0f19b1cc5a92e.tar.gz
rtmux-2a36a0a06763416ad67be9ffdec0f19b1cc5a92e.tar.bz2
rtmux-2a36a0a06763416ad67be9ffdec0f19b1cc5a92e.zip
Sync OpenBSD patchset 1135:
Do not crash when the current session has no window, fixes a bug reported by Giorgio Lando. Fix from Thomas Adam.
-rw-r--r--cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd.c b/cmd.c
index 7aefeffd..7ad52028 100644
--- a/cmd.c
+++ b/cmd.c
@@ -1289,7 +1289,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;
@@ -1303,7 +1303,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 = osdep_get_cwd(s->curw->window->active->pid);
else
return (s->cwd);