ucb: cmis::DataSupplier::queryContent() looks rather questionable
It's not immediately obvious if the caller is responsible for
checking the index validity here, but all the other sub-classes of
ResultSetDataSupplier that i looked at do check the index so do
the same here.
Change-Id: Ib0c5c38cb28282f08752cdb03202e4d6f3566693
(cherry picked from commit 84de69638362c7b575560e0da3efbc709b7ac476)
Reviewed-on: https://gerrit.libreoffice.org/32906
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Ostrovsky <david@ostrovsky.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.cxx b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
index 19754f8..14b3385 100644
--- a/ucb/source/ucp/cmis/cmis_datasupplier.cxx
+++ b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
@@ -68,18 +68,20 @@ namespace cmis
OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
{
return queryContentIdentifier( nIndex )->getContentIdentifier( );
auto const xTemp(queryContentIdentifier(nIndex));
return (xTemp.is()) ? xTemp->getContentIdentifier() : OUString();
}
uno::Reference< ucb::XContentIdentifier > DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
{
return queryContent( nIndex )->getIdentifier( );
auto const xTemp(queryContent(nIndex));
return (xTemp.is()) ? xTemp->getIdentifier() : uno::Reference<ucb::XContentIdentifier>();
}
uno::Reference< ucb::XContent > DataSupplier::queryContent( sal_uInt32 nIndex )
{
if ( nIndex > maResults.size() )
getData( );
if (!getResult(nIndex))
return uno::Reference<ucb::XContent>();
return maResults[ nIndex ]->xContent;
}