extensions/source/ole/oleobjw.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit da51ab330d0f1ed249ee73b5abedbcb3f31bbde5
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Jan 25 18:50:42 2025 +0500
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jan 27 09:37:02 2025 +0100

    tdf#160770: use OUString ctor that takes length, which allows nullptr
    
    bstrDescription can obviously be nullptr.
    
    Change-Id: I09f368a632143479c165cb0653a33aef26fe0e95
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180743
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 1c763a6b88c2efd425e764778fc8c709387cf2ff)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180763
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/extensions/source/ole/oleobjw.cxx 
b/extensions/source/ole/oleobjw.cxx
index d9c0296110fd..e3e5c23357f5 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -430,6 +430,8 @@ void SAL_CALL IUnknownWrapper::setValue( const OUString& 
aPropertyName,
     }
 }
 
+static OUString BStrToOUString(BSTR s) { return OUString(o3tl::toU(s), 
SysStringLen(s)); }
+
 Any SAL_CALL IUnknownWrapper::getValue( const OUString& aPropertyName )
 {
     if ( ! m_spDispatch )
@@ -539,13 +541,13 @@ Any SAL_CALL IUnknownWrapper::getValue( const OUString& 
aPropertyName )
         case DISP_E_BADPARAMCOUNT:
         case DISP_E_BADVARTYPE:
         case DISP_E_EXCEPTION:
-            throw 
RuntimeException(OUString(o3tl::toU(excepinfo.bstrDescription)));
+            throw RuntimeException(BStrToOUString(excepinfo.bstrDescription));
             break;
         case DISP_E_MEMBERNOTFOUND:
-            throw 
UnknownPropertyException(OUString(o3tl::toU(excepinfo.bstrDescription)));
+            throw 
UnknownPropertyException(BStrToOUString(excepinfo.bstrDescription));
             break;
         default:
-            throw 
RuntimeException(OUString(o3tl::toU(excepinfo.bstrDescription)));
+            throw RuntimeException(BStrToOUString(excepinfo.bstrDescription));
             break;
         }
     }

Reply via email to