From 36932a006541b9c3614fbceca331b2dae38a011f Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 5 May 2015 00:37:06 -0300 Subject: avoid crash on some cases of richtextlabel fill, but odd behavior persists, #1803 --- scene/gui/rich_text_label.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scene') diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 4be53839be..3489b02598 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -268,7 +268,9 @@ if (m_height > line_height) {\ } if (found_space) { - fw+=l.offset_caches[line]/l.space_caches[line]; + int ln = MIN(l.offset_caches.size()-1,line); + + fw+=l.offset_caches[ln]/l.space_caches[ln]; } } -- cgit v1.2.3