From 84de69638362c7b575560e0da3efbc709b7ac476 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 9 Jan 2017 18:42:22 +0100 Subject: 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 --- ucb/source/ucp/cmis/cmis_datasupplier.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ucb') diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.cxx b/ucb/source/ucp/cmis/cmis_datasupplier.cxx index 19754f84c216..14b3385ec712 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(); } uno::Reference< ucb::XContent > DataSupplier::queryContent( sal_uInt32 nIndex ) { - if ( nIndex > maResults.size() ) - getData( ); + if (!getResult(nIndex)) + return uno::Reference(); return maResults[ nIndex ]->xContent; } -- cgit v1.2.3