aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-10-26 01:55:22 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-10-26 01:55:22 +0200
commit782865a4e85d5f6c04404be0ee1f5b5318635a8e (patch)
tree986f8b8786fb7a078884e0e67cf647d585992ecc
parent1d28e187158b9648e2dc565b336972fd4a038eab (diff)
do not allow sending message to disconnected server
-rw-r--r--v2/chatty.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/v2/chatty.c b/v2/chatty.c
index 78c0ab1..3c26f66 100644
--- a/v2/chatty.c
+++ b/v2/chatty.c
@@ -415,7 +415,12 @@ int main(int argc, char **argv)
break;
case TB_KEY_CTRL_M: // send message
if (input_len == 0)
+ // do not send empty message
break;
+ if (fds[FDS_SERVER].fd == -1)
+ // do not send message to disconnected server
+ break;
+
// null terminate
input[input_len] = 0;
input_len++;