summaryrefslogtreecommitdiffstats
path: root/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-07-09 09:55:57 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-07-09 09:55:57 +0000
commita3391692ad5800ca034bbbdcd803924fc4e392ee (patch)
tree6fed0442ac7e579ea38eac98e304d8a11b1ffd62 /status.c
parent91f54b59acc8b21dd5c42d5fd95bebc256dc1e1b (diff)
Move a NULL check inside a function, from Tiago Cunha.
Diffstat (limited to 'status.c')
-rw-r--r--status.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/status.c b/status.c
index b90d1885..a1c23286 100644
--- a/status.c
+++ b/status.c
@@ -515,6 +515,9 @@ status_replace(struct client *c, struct session *s, struct winlink *wl,
char in[BUFSIZ], ch, *iptr, *optr;
size_t len;
+ if (fmt == NULL)
+ return (xstrdup(""));
+
len = strftime(in, sizeof in, fmt, localtime(&t));
in[len] = '\0';
@@ -877,8 +880,6 @@ status_prompt_set(struct client *c, const char *msg, const char *input,
c->prompt_string = status_replace(c, NULL, NULL, NULL, msg,
time(NULL), 0);
- if (input == NULL)
- input = "";
c->prompt_buffer = status_replace(c, NULL, NULL, NULL, input,
time(NULL), 0);
c->prompt_index = strlen(c->prompt_buffer);
@@ -932,8 +933,6 @@ status_prompt_update(struct client *c, const char *msg, const char *input)
time(NULL), 0);
xfree(c->prompt_buffer);
- if (input == NULL)
- input = "";
c->prompt_buffer = status_replace(c, NULL, NULL, NULL, input,
time(NULL), 0);
c->prompt_index = strlen(c->prompt_buffer);