From 709c3ec87787701d474c8f8c02126c1f85e2ab7b Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 14 Aug 2013 14:25:59 -0400 Subject: [PATCH] Fix the crash upon opening Bumps, Pushes & Hits Floater There are two types of font names, the camelcase and the all uppercase Since mostly uppercase is used for scroll lists, this issue went undetected but both types are used upstream, so we now look for camelcase if we couldn't get an uppercase one The crash itself is avoided by falling back on SansSerifSmall if no known font has the name provided. --- indra/llui/llscrolllistcell.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 83479888f..6ac851ede 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -174,7 +174,7 @@ U32 LLScrollListText::sCount = 0; LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p) : LLScrollListCell(p), mText(p.value().asString()), - mFont(p.font.isProvided() ? LLResMgr::getInstance()->getRes(p.font) : LLFontGL::getFontSansSerifSmall()), + mFont(LLFontGL::getFontSansSerifSmall()), mColor(p.color), mUseColor(p.color.isProvided()), mFontStyle(LLFontGL::getStyleFromString(p.font_style)), @@ -187,6 +187,19 @@ LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p) mTextWidth = getWidth(); + if (p.font.isProvided()) + { + if (const LLFontGL* font = LLResMgr::getInstance()->getRes(p.font)) // Common CAPITALIZED font name? + mFont = font; + else // Less common camelCase font? + { + LLFontDescriptor font_desc; + font_desc.setName(p.font); + if (const LLFontGL* font = LLFontGL::getFont(font_desc)) + mFont = font; + } + } + // initialize rounded rect image if (!mRoundedRectImage) {