diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-01-09 18:42:22 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-01-09 18:56:57 +0100 |
commit | 84de69638362c7b575560e0da3efbc709b7ac476 (patch) | |
tree | babddde6633ec0bc7c2a0373b30c59a0da7153ff /ucb/source | |
parent | 22779b136058934f1af0dcfa50ba23ea6220db87 (diff) |
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
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/cmis/cmis_datasupplier.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
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<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; } |