throw more useful exception from OPropertySetHelper::getPropertyValue

Change-Id: I90e7ab5763bf368cec795a8c39ece17579dd851d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172905
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
This commit is contained in:
Noel Grandin
2024-09-05 13:51:34 +02:00
parent 6d6422b3ff
commit f8deb64c3c
+3 -1
View File
@@ -273,6 +273,8 @@ Any OPropertySetHelper::getPropertyValue(
IPropertyArrayHelper & rPH = getInfoHelper();
// map the name to the handle
sal_Int32 nHandle = rPH.getHandleByName( rPropertyName );
if (nHandle == -1)
throw UnknownPropertyException(rPropertyName);
// call the method of the XFastPropertySet interface
return getFastPropertyValue( nHandle );
}
@@ -545,8 +547,8 @@ void OPropertySetHelper::setFastPropertyValue( sal_Int32 nHandle, const Any& rVa
// XFastPropertySet
Any OPropertySetHelper::getFastPropertyValue( sal_Int32 nHandle )
{
assert(nHandle != -1 && "passing -1 here indicates that the caller knows this is not a valid handle");
IPropertyArrayHelper & rInfo = getInfoHelper();
if( !rInfo.fillPropertyMembersByHandle( nullptr, nullptr, nHandle ) )
// unknown property