diff --git a/libr/cons/canvas.c b/libr/cons/canvas.c index e34593fd4d..1e716855d7 100644 --- a/libr/cons/canvas.c +++ b/libr/cons/canvas.c @@ -98,13 +98,17 @@ R_API void r_cons_canvas_write(RConsCanvas *c, const char *_s) { char *line, *n; str = s = strdup (_s); - for (i=0;;i++) { + for (i=0; ; i++) { line = getrow (s, &n); p = prefixline (c, &left); slen = R_MIN (left, strlen (line)); + if (slen<1) + break; if (!G (c->x-c->sx+slen, c->y-c->sy)) { // TODO : chop slen slen = (c->w - (c->x-c->sx)); + if (slen<1) + break; continue; } if (!G (c->x-c->sx-slen, c->y-c->sy))