ui: avoid infinite loop when word-wrapping

This commit fixes an infinite loop in draw_text_full(),
happening when there is not enough space to draw even a single
a char before trying to word-wrap.

Signed-off-by: Luca Bruno <lucab@debian.org>
This commit is contained in:
Luca Bruno 2015-04-18 10:45:08 +02:00
parent 20f21fb925
commit 0d7860c675

View File

@ -694,6 +694,9 @@ void ui_manager::draw_text_full(render_container *container, const char *origs,
break; break;
curwidth -= get_font()->char_width(lineheight, aspect, schar); curwidth -= get_font()->char_width(lineheight, aspect, schar);
// if back to 0, there is no space to draw even a single char
if (curwidth <= 0)
break;
} }
} }