aboutsummaryrefslogtreecommitdiff
path: root/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2014-02-17 18:09:25 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2014-02-17 18:09:25 +0000
commitd325104d10b699e8c85cddd7ee9b7d2273c8cf40 (patch)
treeed3512ff09e388cb3f91c82ea5bad6a13d745a09 /status.c
parent3aadc9d665fd3ec52181c5e1d8bd2d6481a97fef (diff)
parentb3de4a3dec85bc84bb83da6b46e2a8e2a634ace3 (diff)
downloadrtmux-d325104d10b699e8c85cddd7ee9b7d2273c8cf40.tar.gz
rtmux-d325104d10b699e8c85cddd7ee9b7d2273c8cf40.tar.bz2
rtmux-d325104d10b699e8c85cddd7ee9b7d2273c8cf40.zip
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
Diffstat (limited to 'status.c')
-rw-r--r--status.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/status.c b/status.c
index ffc66ad5..9967dc68 100644
--- a/status.c
+++ b/status.c
@@ -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);
@@ -686,7 +690,7 @@ status_message_set(struct client *c, const char *fmt, ...)
tv.tv_sec = delay / 1000;
tv.tv_usec = (delay % 1000) * 1000L;
- if (event_initialized (&c->message_timer))
+ if (event_initialized(&c->message_timer))
evtimer_del(&c->message_timer);
evtimer_set(&c->message_timer, status_message_callback, c);
evtimer_add(&c->message_timer, &tv);