diff options
author | nicm <nicm> | 2014-02-14 12:37:54 +0000 |
---|---|---|
committer | nicm <nicm> | 2014-02-14 12:37:54 +0000 |
commit | d0accdba884517c55a842dec59ef2c8db6c208b5 (patch) | |
tree | b3eef9fefd3cdd7a7dc91f2dc120ab1c145e4f82 /status.c | |
parent | f58721a9e8831f5e47e05fceb7fa5558ddb612ff (diff) |
Check for NULL session and whatnot in status_replace, from Thomas Adam.
Diffstat (limited to 'status.c')
-rw-r--r-- | status.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -445,11 +445,11 @@ status_replace(struct client *c, struct session *s, struct winlink *wl, if (fmt == NULL) return (xstrdup("")); - if (s == NULL) + if (s == NULL && c != NULL) s = c->session; - if (wl == NULL) + if (wl == NULL && s != NULL) wl = s->curw; - if (wp == NULL) + if (wp == NULL && wl != NULL) wp = wl->window->active; len = strftime(in, sizeof in, fmt, localtime(&t)); @@ -472,10 +472,14 @@ status_replace(struct client *c, struct session *s, struct winlink *wl, *optr = '\0'; ft = format_create(); - format_client(ft, c); - format_session(ft, s); - format_winlink(ft, s, wl); - format_window_pane(ft, wp); + if (c != NULL) + format_client(ft, c); + if (s != NULL) + format_session(ft, s); + if (s != NULL && wl != NULL) + format_winlink(ft, s, wl); + if (wp != NULL) + format_window_pane(ft, wp); expanded = format_expand(ft, out); format_free(ft); return (expanded); |