Don't instantiate LLTextParser::getInstance before user logged in.

This commit is contained in:
Aleric Inglewood
2011-08-02 23:26:02 +02:00
parent 414666ec90
commit 27c91e2571
3 changed files with 18 additions and 7 deletions

View File

@@ -245,15 +245,14 @@ LLSD LLTextParser::loadFromDisk()
bool LLTextParser::saveToDisk(LLSD highlights) bool LLTextParser::saveToDisk(LLSD highlights)
{ {
mHighlights=highlights; mHighlights=highlights;
std::string filename=getFileName(); if (gDirUtilp->getLindenUserDir(true).empty())
if (filename.empty())
{ {
llwarns << "LLTextParser::saveToDisk() no valid user directory." << llendl; // User didn't login, so nothing to save.
return FALSE; return false;
} }
llofstream file; llofstream file;
file.open(filename.c_str()); file.open(getFileName().c_str());
LLSDSerialize::toPrettyXML(mHighlights, file); LLSDSerialize::toPrettyXML(mHighlights, file);
file.close(); file.close();
return TRUE; return true;
} }

View File

@@ -456,6 +456,14 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo
LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_time) LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_time)
: mParagraphText(str), mAddTime(add_time), mMaxWidth(-1) : mParagraphText(str), mAddTime(add_time), mMaxWidth(-1)
{ {
makeParagraphColorSegments(color); // Only call makeParagraphColorSegments if the user logged in already (we come
// here before he logged in when they disabled login/logout screens).
// Otherwise makeParagraphColorSegments calls LLTextParser::getInstance() which
// causes a one-time initialization by reading highlights.xml, which fails
// when not logged in because it's per account.
if (!gDirUtilp->getLindenUserDir(true).empty())
{
makeParagraphColorSegments(color);
}
} }

View File

@@ -497,6 +497,10 @@ void LLFloaterChat::addChat(const LLChat& chat,
//static //static
void LLFloaterChat::triggerAlerts(const std::string& text) void LLFloaterChat::triggerAlerts(const std::string& text)
{ {
// Cannot instantiate LLTextParser before logging in.
if (gDirUtilp->getLindenUserDir(true).empty())
return;
LLTextParser* parser = LLTextParser::getInstance(); LLTextParser* parser = LLTextParser::getInstance();
// bool spoken=FALSE; // bool spoken=FALSE;
for (S32 i=0;i<parser->mHighlights.size();i++) for (S32 i=0;i<parser->mHighlights.size();i++)