summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-02-05 11:01:46 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-02-05 11:01:46 +0000
commit2a0ead63be18af9221cd2ba903800152bc178a77 (patch)
tree0a6a057d35de5e2163be39607c6abc11947c40ad /usr.bin/tmux
parentf42e9f8874959a9b4649567e43da3c854bc4fd8e (diff)
Don't set some string formats if the string is NULL.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/format.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index c999827fd22..42ed32f32f1 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.11 2013/01/18 02:16:21 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.12 2013/02/05 11:01:45 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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