From 2057e7bc4fa141a3834d36e47a7f8e2e87a3195a Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Thu, 28 Nov 2013 18:56:56 -0500 Subject: [PATCH] couple fixes --- src/chat.c | 3 +++ src/global_commands.c | 2 +- src/misc_tools.c | 2 +- src/misc_tools.h | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/chat.c b/src/chat.c index ddc475d..6a66d3a 100644 --- a/src/chat.c +++ b/src/chat.c @@ -207,6 +207,9 @@ static void chat_onFileData(ToxWindow *self, Tox *m, int num, uint8_t filenum, u // we have a problem here, but don't let it segfault if (file_to_save == NULL) { + wattron(ctx->history, COLOR_PAIR(RED)); + wprintw(ctx->history, "* Error writing to file.\n"); + wattroff(ctx->history, COLOR_PAIR(RED)); return; } diff --git a/src/global_commands.c b/src/global_commands.c index f1badd7..b318b94 100644 --- a/src/global_commands.c +++ b/src/global_commands.c @@ -239,7 +239,7 @@ void cmd_nick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA if (len > TOXIC_MAX_NAME_LENGTH) { nick[TOXIC_MAX_NAME_LENGTH] = L'\0'; - len = TOXIC_MAX_NAME_LENGTH; + len = TOXIC_MAX_NAME_LENGTH - 1; } tox_setname(m, nick, len+1); diff --git a/src/misc_tools.c b/src/misc_tools.c index 1c99932..5e23043 100644 --- a/src/misc_tools.c +++ b/src/misc_tools.c @@ -152,4 +152,4 @@ bool valid_nick(uint8_t *nick) } return true; -} \ No newline at end of file +} diff --git a/src/misc_tools.h b/src/misc_tools.h index d27000d..789ff62 100644 --- a/src/misc_tools.h +++ b/src/misc_tools.h @@ -35,4 +35,4 @@ int name_compare(const void *nick1, const void *nick2); - cannot be empty - cannot start with a space - must not contain contiguous spaces */ -bool valid_nick(uint8_t *nick); \ No newline at end of file +bool valid_nick(uint8_t *nick);