mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 15:13:27 +01:00
don't allow empty nicks
This commit is contained in:
parent
9c6662163b
commit
663818156b
@ -219,7 +219,7 @@ void cmd_nick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
||||
{
|
||||
/* check arguments */
|
||||
if (argc < 1) {
|
||||
wprintw(window, "Invalid syntax.\n");
|
||||
wprintw(window, "Invalid name.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -232,6 +232,11 @@ void cmd_nick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
||||
nick[len] = L'\0';
|
||||
}
|
||||
|
||||
if(!len) {
|
||||
wprintw(window, "Invalid name.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (len > TOXIC_MAX_NAME_LENGTH) {
|
||||
nick[TOXIC_MAX_NAME_LENGTH] = L'\0';
|
||||
len = TOXIC_MAX_NAME_LENGTH;
|
||||
|
Loading…
Reference in New Issue
Block a user