summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-02-05 11:01:45 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-02-05 11:01:45 +0000
commita5521597b0e0771d5ad698bba92801ea88302c4f (patch)
treee34c1c346bbdc6fed7c8da649437b633062df260
parent85531fd404ed68ffe7d724f58ef1f84c357f3cc8 (diff)
Don't set some string formats if the string is NULL.
-rw-r--r--format.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/format.c b/format.c
index 72c65c28..e950df53 100644
--- a/format.c
+++ b/format.c
@@ -365,6 +365,7 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
unsigned long long size;
u_int i;
u_int idx;
+ const char *cwd;
size = 0;
for (i = 0; i < gd->hsize; i++) {
@@ -390,9 +391,11 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
format_add(ft, "pane_start_command", "%s", wp->cmd);
if (wp->cwd != NULL)
format_add(ft, "pane_start_path", "%s", wp->cwd);
- format_add(ft, "pane_current_path", "%s", get_proc_cwd(wp->fd));
+ if ((cwd = get_proc_cwd(wp->fd)) != NULL)
+ format_add(ft, "pane_current_path", "%s", cwd);
format_add(ft, "pane_pid", "%ld", (long) wp->pid);
- format_add(ft, "pane_tty", "%s", wp->tty);
+ if (wp->tty != NULL)
+ format_add(ft, "pane_tty", "%s", wp->tty);
}
void