Don't set some string formats if the string is NULL.

pull/1/head
Nicholas Marriott 2013-02-05 11:01:45 +00:00
parent 85531fd404
commit a5521597b0
1 changed files with 5 additions and 2 deletions

View File

@ -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