diff options
author | 2013-02-05 11:01:45 +0000 | |
---|---|---|
committer | 2013-02-05 11:01:45 +0000 | |
commit | 7a83b6539d123f30a572cba4bfb91a9c9ff18ac5 (patch) | |
tree | 4d868f4ad6f286801ddfc6660f04b3217bd39162 | |
parent | Spelling fixes: retreive -> retrieve. ok gilles (diff) | |
download | wireguard-openbsd-7a83b6539d123f30a572cba4bfb91a9c9ff18ac5.tar.xz wireguard-openbsd-7a83b6539d123f30a572cba4bfb91a9c9ff18ac5.zip |
Don't set some string formats if the string is NULL.
-rw-r--r-- | usr.bin/tmux/format.c | 9 |
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 |