diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-10-23 13:00:47 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-10-24 15:52:00 +0200 |
commit | f66508b4f2591b4c378523b2187c42ab8d949c35 (patch) | |
tree | 1806bcd21ba6b2edc7bed274bfe56b0a7cc0db83 /comphelper | |
parent | b3adc88a5b73125bb6dd7f2ccb76ff6a382efd2e (diff) |
assert on invalid param in OPropertyContainerHelper::getFastPropertyValue
which flushes out a bug in OPropertySetHelper::getPropertyValueImp
Change-Id: I5d3928e55eb9f019629896ad6478011520318fd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175474
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit caf1bc0c4c559999d44b83ff8ace43b5e7fcf3f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175494
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/property/propertycontainerhelper.cxx | 2 | ||||
-rw-r--r-- | comphelper/source/property/propshlp.cxx | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index ee81100ae617..1ce9ad4ea8c5 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.cxx @@ -399,7 +399,7 @@ void OPropertyContainerHelper::getFastPropertyValue(Any& _rValue, sal_Int32 _nHa PropertiesIterator aPos = const_cast<OPropertyContainerHelper*>(this)->searchHandle(_nHandle); if (aPos == m_aProperties.end()) { - OSL_FAIL( "OPropertyContainerHelper::getFastPropertyValue: unknown handle!" ); + assert( false && "OPropertyContainerHelper::getFastPropertyValue: unknown handle" ); // should not happen if the derived class has built a correct property set info helper to be used by // our base class OPropertySetHelper return; diff --git a/comphelper/source/property/propshlp.cxx b/comphelper/source/property/propshlp.cxx index b0139c747969..d15db5c7e2df 100644 --- a/comphelper/source/property/propshlp.cxx +++ b/comphelper/source/property/propshlp.cxx @@ -176,6 +176,8 @@ Any OPropertySetHelper::getPropertyValueImpl(std::unique_lock<std::mutex>& rGuar 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 Any aAny; getFastPropertyValue(rGuard, aAny, nHandle); |