Merged in maxim_productengine/viewer-neko_maint2 (pull request #104)

MAINT-6967 FIXED Crash in LLFloaterAvatarPicker::find()
meow-7.2.2
Andrey Lihatskiy 2016-11-30 04:41:48 +00:00
commit c7a9cbc646
1 changed files with 29 additions and 27 deletions

View File

@ -502,37 +502,39 @@ void LLFloaterAvatarPicker::find()
url.reserve(128); // avoid a memory allocation or two
LLViewerRegion* region = gAgent.getRegion();
url = region->getCapability("AvatarPickerSearch");
// Prefer use of capabilities to search on both SLID and display name
if (!url.empty())
if(region)
{
// capability urls don't end in '/', but we need one to parse
// query parameters correctly
if (url.size() > 0 && url[url.size()-1] != '/')
url = region->getCapability("AvatarPickerSearch");
// Prefer use of capabilities to search on both SLID and display name
if (!url.empty())
{
url += "/";
// capability urls don't end in '/', but we need one to parse
// query parameters correctly
if (url.size() > 0 && url[url.size()-1] != '/')
{
url += "/";
}
url += "?page_size=100&names=";
std::replace(text.begin(), text.end(), '.', ' ');
url += LLURI::escape(text);
LL_INFOS() << "avatar picker " << url << LL_ENDL;
LLCoros::instance().launch("LLFloaterAvatarPicker::findCoro",
boost::bind(&LLFloaterAvatarPicker::findCoro, url, mQueryID, getKey().asString()));
}
else
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("AvatarPickerRequest");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->addUUID("QueryID", mQueryID); // not used right now
msg->nextBlock("Data");
msg->addString("Name", text);
gAgent.sendReliableMessage();
}
url += "?page_size=100&names=";
std::replace(text.begin(), text.end(), '.', ' ');
url += LLURI::escape(text);
LL_INFOS() << "avatar picker " << url << LL_ENDL;
LLCoros::instance().launch("LLFloaterAvatarPicker::findCoro",
boost::bind(&LLFloaterAvatarPicker::findCoro, url, mQueryID, getKey().asString()));
}
else
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("AvatarPickerRequest");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->addUUID("QueryID", mQueryID); // not used right now
msg->nextBlock("Data");
msg->addString("Name", text);
gAgent.sendReliableMessage();
}
getChild<LLScrollListCtrl>("SearchResults")->deleteAllItems();
getChild<LLScrollListCtrl>("SearchResults")->setCommentText(getString("searching"));