summaryrefslogtreecommitdiffstats
path: root/cmd-save-buffer.c
diff options
context:
space:
mode:
authornicm <nicm>2016-03-05 07:47:52 +0000
committernicm <nicm>2016-03-05 07:47:52 +0000
commitc38e0a4bbc722865f934db1282ca6f086874f530 (patch)
tree11bc418c7ac39765ef98861de1823af70d480d0d /cmd-save-buffer.c
parent1f0b317088aaeb230d69f13f43ed63b7406c6fd1 (diff)
Do not use c->cwd or s->cwd if it is NULL, found by Ben Boeckel.
Diffstat (limited to 'cmd-save-buffer.c')
-rw-r--r--cmd-save-buffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c
index 591390b5..3aaf8159 100644
--- a/cmd-save-buffer.c
+++ b/cmd-save-buffer.c
@@ -98,9 +98,9 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
goto do_print;
}
- if (c != NULL && c->session == NULL)
+ if (c != NULL && c->session == NULL && c->cwd != NULL)
cwd = c->cwd;
- else if ((s = c->session) != NULL)
+ else if ((s = c->session) != NULL && s->cwd != NULL)
cwd = s->cwd;
else
cwd = ".";