diff options
author | McCabe Maxsted | 2010-08-29 14:50:20 -0700 |
---|---|---|
committer | McCabe Maxsted | 2010-08-29 15:06:47 -0700 |
commit | 1865d88536eb459a11bba3c2f544cb2863a59fbf (patch) | |
tree | 72326aae9eb50074942e9408494372e4a56e23e6 | |
parent | Fixed windlight water/sky notecards opening the notecard preview window on cr... (diff) | |
download | meta-impy-1865d88536eb459a11bba3c2f544cb2863a59fbf.zip meta-impy-1865d88536eb459a11bba3c2f544cb2863a59fbf.tar.gz meta-impy-1865d88536eb459a11bba3c2f544cb2863a59fbf.tar.bz2 meta-impy-1865d88536eb459a11bba3c2f544cb2863a59fbf.tar.xz |
Potential fix for a crash in llfontgl
-rw-r--r-- | linden/indra/llrender/llfontgl.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/linden/indra/llrender/llfontgl.cpp b/linden/indra/llrender/llfontgl.cpp index beecb6b..5d3d6a7 100644 --- a/linden/indra/llrender/llfontgl.cpp +++ b/linden/indra/llrender/llfontgl.cpp | |||
@@ -725,17 +725,18 @@ F32 LLFontGL::getWidthF32(const std::string& utf8text, const S32 begin_offset, c | |||
725 | 725 | ||
726 | F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S32 max_chars, BOOL use_embedded) const | 726 | F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S32 max_chars, BOOL use_embedded) const |
727 | { | 727 | { |
728 | if (!wchars || !wchars[0] || max_chars == 0) | ||
729 | { | ||
730 | return 0; | ||
731 | } | ||
732 | |||
728 | const S32 LAST_CHARACTER = LLFont::LAST_CHAR_FULL; | 733 | const S32 LAST_CHARACTER = LLFont::LAST_CHAR_FULL; |
729 | 734 | ||
730 | F32 cur_x = 0; | 735 | F32 cur_x = 0; |
731 | const S32 max_index = begin_offset + max_chars; | 736 | const S32 max_index = begin_offset + max_chars; |
732 | for (S32 i = begin_offset; i < max_index; i++) | 737 | for (S32 i = begin_offset; i < max_index && wchars[i] != 0; i++) |
733 | { | 738 | { |
734 | const llwchar wch = wchars[i]; | 739 | llwchar wch = wchars[i]; |
735 | if (wch == 0) | ||
736 | { | ||
737 | break; // done | ||
738 | } | ||
739 | const embedded_data_t* ext_data = use_embedded ? getEmbeddedCharData(wch) : NULL; | 740 | const embedded_data_t* ext_data = use_embedded ? getEmbeddedCharData(wch) : NULL; |
740 | if (ext_data) | 741 | if (ext_data) |
741 | { | 742 | { |
@@ -764,6 +765,11 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, const S32 begin_offset, const S | |||
764 | cur_x = (F32)llfloor(cur_x + 0.5f); | 765 | cur_x = (F32)llfloor(cur_x + 0.5f); |
765 | } | 766 | } |
766 | 767 | ||
768 | if (cur_x == 0) | ||
769 | { | ||
770 | return cur_x; | ||
771 | } | ||
772 | |||
767 | return cur_x / sScaleX; | 773 | return cur_x / sScaleX; |
768 | } | 774 | } |
769 | 775 | ||