2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Ensure pyGUIControlListBox::GetElementW can't attempt to return a null pointer as a std::wstring

This commit is contained in:
ZarothYe
2022-03-05 13:34:52 -06:00
parent 4c76549fb3
commit 2f1bb87056

View File

@ -587,16 +587,17 @@ std::wstring pyGUIControlListBox::GetElementW( UInt16 idx )
{ {
// if its a text element type then it should be safe to cast it to a pfGUIListText // if its a text element type then it should be safe to cast it to a pfGUIListText
pfGUIListText* letext = (pfGUIListText*)le; pfGUIListText* letext = (pfGUIListText*)le;
return letext->GetText(); return (letext->GetText() != nullptr) ? letext->GetText() : L"";
} }
else if ( le->GetType() == pfGUIListElement::kTreeRoot ) else if ( le->GetType() == pfGUIListElement::kTreeRoot )
{ {
pfGUIListTreeRoot* elroot = (pfGUIListTreeRoot*)le; pfGUIListTreeRoot* elroot = (pfGUIListTreeRoot*)le;
return elroot->GetTitle(); return (elroot->GetTitle() != nullptr) ? elroot->GetTitle() : L"";
} }
} }
} }
} }
return L""; return L"";
} }