Merge pull request #2085 from RyeMutt/crash-fixes

Fix various nullptr crashes
master
Andrey Lihatskiy 2024-07-22 18:54:09 +03:00 committed by GitHub
commit dc2aab4ee4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 48 additions and 24 deletions

View File

@ -1479,7 +1479,11 @@ const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const
item = getFirstSelected();
if (item)
{
return item->getColumn(column)->getValue().asString();
auto col = item->getColumn(column);
if(col)
{
return col->getValue().asString();
}
}
return LLStringUtil::null;

View File

@ -988,11 +988,14 @@ void LLFloaterIMContainer::onAddButtonClicked()
{
LLView * button = findChild<LLView>("conversations_pane_buttons_expanded")->findChild<LLButton>("add_btn");
LLFloater* root_floater = gFloaterView->getParentFloater(this);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMContainer::onAvatarPicked, this, _1), true, true, true, root_floater->getName(), button);
if (picker && root_floater)
if (button && root_floater)
{
root_floater->addDependentFloater(picker);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMContainer::onAvatarPicked, this, _1), true, true, true, root_floater->getName(), button);
if (picker)
{
root_floater->addDependentFloater(picker);
}
}
}

View File

@ -3042,13 +3042,16 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
gIMMgr->addSession(correct_session_name, type, session_id, payload["voice_channel_info"]);
std::string url = gAgent.getRegion()->getCapability(
std::string url = gAgent.getRegionCapability(
"ChatSessionRequest");
if (voice)
{
LLCoros::instance().launch("chatterBoxInvitationCoro",
boost::bind(&chatterBoxInvitationCoro, url, session_id, inv_type, payload["voice_channel_info"]));
if(!url.empty())
{
LLCoros::instance().launch("chatterBoxInvitationCoro",
boost::bind(&chatterBoxInvitationCoro, url, session_id, inv_type, payload["voice_channel_info"]));
}
// send notification message to the corresponding chat
if (payload["notify_box_type"].asString() == "VoiceInviteGroup" || payload["notify_box_type"].asString() == "VoiceInviteAdHoc")
@ -4063,9 +4066,12 @@ public:
// Send request for chat history, if enabled.
if (gSavedPerAccountSettings.getBOOL("FetchGroupChatHistory"))
{
std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest");
LLCoros::instance().launch("chatterBoxHistoryCoro",
boost::bind(&chatterBoxHistoryCoro, url, session_id, "", "", 0));
std::string url = gAgent.getRegionCapability("ChatSessionRequest");
if (!url.empty())
{
LLCoros::instance().launch("chatterBoxHistoryCoro",
boost::bind(&chatterBoxHistoryCoro, url, session_id, "", "", 0));
}
}
}
}

View File

@ -961,7 +961,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
}
}
if (obj->getType() != LLAssetType::AT_CATEGORY)
if (obj && obj->getType() != LLAssetType::AT_CATEGORY)
{
items.push_back(std::string("Paste Separator"));
}

View File

@ -643,7 +643,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
}
// Select any newly created object that has the auto rename at top of folder root set.
if(mFolderRoot.get()->getRoot()->needsAutoRename())
if(mFolderRoot.get() && mFolderRoot.get()->getRoot()->needsAutoRename())
{
setSelection(item_id, false);
}

View File

@ -647,10 +647,18 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
if ("collapse_all" == command_name)
{
if (!mCurrentSelectedList)
{
return false;
}
return has_expanded_folders(mCurrentSelectedList->getRootFolder());
}
else if ("expand_all" == command_name)
{
if (!mCurrentSelectedList)
{
return false;
}
return has_collapsed_folders(mCurrentSelectedList->getRootFolder());
}
else if ("sort_by_date" == command_name)
@ -959,12 +967,12 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold
// then ask LLFolderView permissions
LLFolderView* root_folder = mCurrentSelectedList->getRootFolder();
LLFolderView* root_folder = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : nullptr;
if ("copy" == command_name)
{
// we shouldn't be able to copy folders from My Inventory Panel
return can_be_modified && root_folder->canCopy();
return can_be_modified && root_folder && root_folder->canCopy();
}
else if ("collapse" == command_name)
{
@ -981,7 +989,7 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold
if ("cut" == command_name)
{
can_be_modified = root_folder->canCut();
can_be_modified = root_folder && root_folder->canCut();
}
else if ("rename" == command_name)
{
@ -993,7 +1001,7 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold
}
else if("paste" == command_name)
{
can_be_modified = root_folder->canPaste();
can_be_modified = root_folder && root_folder->canPaste();
}
else
{

View File

@ -263,12 +263,15 @@ static bool handleAnisotropicChanged(const LLSD& newvalue)
static bool handleVSyncChanged(const LLSD& newvalue)
{
LLPerfStats::tunables.vsyncEnabled = newvalue.asBoolean();
gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean());
if (newvalue.asBoolean())
if (gViewerWindow && gViewerWindow->getWindow())
{
U32 current_target = gSavedSettings.getU32("TargetFPS");
gSavedSettings.setU32("TargetFPS", std::min((U32)gViewerWindow->getWindow()->getRefreshRate(), current_target));
gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean());
if (newvalue.asBoolean())
{
U32 current_target = gSavedSettings.getU32("TargetFPS");
gSavedSettings.setU32("TargetFPS", std::min((U32)gViewerWindow->getWindow()->getRefreshRate(), current_target));
}
}
return true;

View File

@ -1271,7 +1271,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
LLTextureEntry *te = obj->getTE(object_face);
// can modify URL if we can modify the object or we have navigate permissions
bool allow_modify_url = obj->permModify() || obj->hasMediaPermission( te->getMediaData(), LLVOVolume::MEDIA_PERM_INTERACT );
bool allow_modify_url = obj->permModify() || (te && obj->hasMediaPermission( te->getMediaData(), LLVOVolume::MEDIA_PERM_INTERACT ));
if (te && allow_modify_url )
{

View File

@ -316,7 +316,7 @@ bool LLXMLRPCTransaction::Impl::process()
if (!LLXMLNode::parseBuffer(mResponseText.data(), mResponseText.size(),
root, nullptr))
{
LL_WARNS() << "Failed parsing XML in response; request URI: "
LL_WARNS() << "Failed parsing XML in response; request URI: "
<< mURI << LL_ENDL;
}
else if (parseResponse(root))