1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-12-16 20:56:34 +01:00

better error handling for failed string conversions

This commit is contained in:
Jfreegman
2013-12-12 00:37:29 -05:00
parent 12e1a60ca3
commit 1dad3711c4
3 changed files with 38 additions and 30 deletions

View File

@@ -438,12 +438,16 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
wclear(ctx->linewin);
uint8_t line[MAX_STR_SIZE];
if (ctx->len > 0) {
uint8_t line[MAX_STR_SIZE];
if (wcs_to_mbs_buf(line, ctx->line, MAX_STR_SIZE) == -1)
memset(&line, 0, sizeof(line));
mvwprintw(ctx->linewin, 1, 0, "%s", line);
if (wcs_to_mbs_buf(line, ctx->line, MAX_STR_SIZE) == -1) {
reset_buf(ctx->line, &ctx->pos, &ctx->len);
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
} else {
mvwprintw(ctx->linewin, 1, 0, "%s", line);
}
}
wclear(ctx->sidebar);
mvwhline(ctx->linewin, 0, 0, ACS_HLINE, x2);