#3836 Fix crash at LLNotificationForm::getNumElements()/LLSD::size()

meow-7.2.2
Andrey Lihatskiy 2025-03-29 14:40:33 +02:00
parent 6ac1d4f3e3
commit 193cab14c2
1 changed files with 14 additions and 0 deletions

View File

@ -614,6 +614,13 @@ void LLNotification::cancel()
LLSD LLNotification::getResponseTemplate(EResponseTemplateType type)
{
LLSD response = LLSD::emptyMap();
if (!mForm)
{
LL_WARNS("Notifications") << "Null form when getting response template for notification " << getName() << LL_ENDL;
return response;
}
for (S32 element_idx = 0;
element_idx < mForm->getNumElements();
++element_idx)
@ -1465,6 +1472,13 @@ bool LLNotifications::templateExists(std::string_view name)
void LLNotifications::forceResponse(const LLNotification::Params& params, S32 option)
{
LLNotificationPtr temp_notify(new LLNotification(params));
if (!temp_notify->getForm())
{
LL_WARNS("Notifications") << "Cannot force response for notification with null form: " << (std::string)params.name << LL_ENDL;
return;
}
LLSD response = temp_notify->getResponseTemplate();
LLSD selected_item = temp_notify->getForm()->getElement(option);