mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Don't set some string formats if the string is NULL.
This commit is contained in:
parent
85531fd404
commit
a5521597b0
5
format.c
5
format.c
@ -365,6 +365,7 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
|
|||||||
unsigned long long size;
|
unsigned long long size;
|
||||||
u_int i;
|
u_int i;
|
||||||
u_int idx;
|
u_int idx;
|
||||||
|
const char *cwd;
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
for (i = 0; i < gd->hsize; i++) {
|
for (i = 0; i < gd->hsize; i++) {
|
||||||
@ -390,8 +391,10 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
|
|||||||
format_add(ft, "pane_start_command", "%s", wp->cmd);
|
format_add(ft, "pane_start_command", "%s", wp->cmd);
|
||||||
if (wp->cwd != NULL)
|
if (wp->cwd != NULL)
|
||||||
format_add(ft, "pane_start_path", "%s", wp->cwd);
|
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_pid", "%ld", (long) wp->pid);
|
||||||
|
if (wp->tty != NULL)
|
||||||
format_add(ft, "pane_tty", "%s", wp->tty);
|
format_add(ft, "pane_tty", "%s", wp->tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user