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.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2025-01-25 16:55:16 +01:00
parent 62a4a9659c
commit 1c763a6b88
+5 -3
View File
@@ -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;
}
}