Skip to content

Commit

Permalink
chafa: Improve error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
hpjansson committed Jan 4, 2024
1 parent 0ae1717 commit bbb7b2e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/chafa/chafa.c
Expand Up @@ -2455,15 +2455,16 @@ write_cursor_down_scroll_n (gint n)
gchar buf [BUFFER_MAX];
gchar *p0 = buf;

if (n == 0)
if (n < 1)
return TRUE;

for ( ; n; n--)
{
p0 = chafa_term_info_emit_cursor_down_scroll (options.term_info, p0);
if (p0 - buf + CHAFA_TERM_SEQ_LENGTH_MAX > BUFFER_MAX)
{
write_to_stdout (buf, p0 - buf);
if (!write_to_stdout (buf, p0 - buf))
return FALSE;
p0 = buf;
}
}
Expand Down

0 comments on commit bbb7b2e

Please sign in to comment.