From 2f1bb87056253129af99d65cb89fb6e148e3cdab Mon Sep 17 00:00:00 2001 From: ZarothYe Date: Sat, 5 Mar 2022 13:34:52 -0600 Subject: [PATCH] Ensure pyGUIControlListBox::GetElementW can't attempt to return a null pointer as a std::wstring --- Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp index 09413368..19f45d73 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp @@ -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 pfGUIListText* letext = (pfGUIListText*)le; - return letext->GetText(); + return (letext->GetText() != nullptr) ? letext->GetText() : L""; } else if ( le->GetType() == pfGUIListElement::kTreeRoot ) { pfGUIListTreeRoot* elroot = (pfGUIListTreeRoot*)le; - return elroot->GetTitle(); + return (elroot->GetTitle() != nullptr) ? elroot->GetTitle() : L""; } } } } + return L""; }