tdf#167599: check the result of UNO_QUERY

Not all objects implement XServiceInfo. Any query must either be
UNO_QUERY_THROW, or check its result after UNO_QUERY.

Change-Id: I8b1d7c719c4a43a4d658957ad5a91181dc265186
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188080
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2025-07-20 09:01:38 +02:00
parent 32ba891829
commit 1250533489

View File

@ -1275,6 +1275,9 @@ void ObjectInspectorTreeHandler::appendServices(uno::Reference<uno::XInterface>
return;
auto xServiceInfo = uno::Reference<lang::XServiceInfo>(xInterface, uno::UNO_QUERY);
if (!xServiceInfo)
return;
const uno::Sequence<OUString> aServiceNames(xServiceInfo->getSupportedServiceNames());
for (auto const& aServiceName : aServiceNames)
{