summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpranomostro <pranomestro@gmail.com>2016-11-23 10:59:24 +0100
committerpranomostro <pranomestro@gmail.com>2016-11-23 10:59:24 +0100
commite07cf0867e38a8dbbba1a7fcb1a91d19beb37a8e (patch)
tree8ddbb06181d7ba42945b5fa3e25ec00f3c2881f8
parent69b6fbcd0eecb1253a0e685c2ac4b1555d7bd1c2 (diff)
Make sending only a newline succeed (patch by z3bra).
-rw-r--r--ratox.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ratox.c b/ratox.c
index 4c05822..413183d 100644
--- a/ratox.c
+++ b/ratox.c
@@ -896,7 +896,7 @@ sendfriendtext(struct friend *f)
n = fiforead(f->dirfd, &f->fd[FTEXT_IN], ffiles[FTEXT_IN], buf, sizeof(buf));
if (n <= 0)
return;
- if (buf[n - 1] == '\n')
+ if (buf[n - 1] == '\n' && n > 1)
n--;
tox_friend_send_message(tox, f->num, TOX_MESSAGE_TYPE_NORMAL, buf, n, &err);
if (err != TOX_ERR_FRIEND_SEND_MESSAGE_OK)