comphelper/source/property/propertycontainerhelper.cxx |    2 +-
 comphelper/source/property/propshlp.cxx                |    2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit f66508b4f2591b4c378523b2187c42ab8d949c35
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Oct 23 13:00:47 2024 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Oct 24 15:52:00 2024 +0200

    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 <[email protected]>
    (cherry picked from commit caf1bc0c4c559999d44b83ff8ace43b5e7fcf3f1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175494
    Reviewed-by: Xisco Fauli <[email protected]>

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);

Reply via email to