summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-09-30 15:42:29 +0100
committersin <sin@2f30.org>2014-09-30 15:42:29 +0100
commit3fcf991243ecfed7ba72aea6f079a7e7c229cbee (patch)
treebb292af69259dd169d2cb7288cd9fb4ce8637272
parent9220278996070338658410af496cdcb969c0d9c6 (diff)
Be consistent in how we default to the "Anonymous" name
-rw-r--r--ratox.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ratox.c b/ratox.c
index aa57a33..7df403b 100644
--- a/ratox.c
+++ b/ratox.c
@@ -290,10 +290,12 @@ cbconnstatus(Tox *m, int32_t frnum, uint8_t status, void *udata)
eprintf("Failed to get name for friend number %ld\n",
(long)frnum);
- name[r] = '\0';
+ if (r == 0)
+ snprintf(name, sizeof(name), "Anonymous");
+ else
+ name[r] = '\0';
- printout(": %s > %s\n", r == 0 ? (uint8_t *)"Anonymous" : name,
- status == 0 ? "Offline" : "Online");
+ printout(": %s > %s\n", name, status == 0 ? "Offline" : "Online");
TAILQ_FOREACH(f, &friendhead, entry) {
if (f->num == frnum) {