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.
This commit is contained in:
Inusaito Sayori
2013-08-14 14:25:59 -04:00
parent 07e09be280
commit 709c3ec877

View File

@@ -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)
{