aboutsummaryrefslogtreecommitdiff
path: root/status.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2014-02-16 23:02:07 +0000
committerThomas Adam <thomas@xteddy.org>2014-02-16 23:02:07 +0000
commitb3de4a3dec85bc84bb83da6b46e2a8e2a634ace3 (patch)
tree8704cc16b1ed5380bcd7c678351d85adfd5907c8 /status.c
parent8edbbb98656a76f0a25b5243b526709a67ae3531 (diff)
parent81db6bab91309e7cb42628048408c10504522a48 (diff)
downloadrtmux-b3de4a3dec85bc84bb83da6b46e2a8e2a634ace3.tar.gz
rtmux-b3de4a3dec85bc84bb83da6b46e2a8e2a634ace3.tar.bz2
rtmux-b3de4a3dec85bc84bb83da6b46e2a8e2a634ace3.zip
Merge branch 'obsd-master'
Conflicts: tmux.1 tmux.c
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);