diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-01-09 18:42:22 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-01-10 15:15:02 +0000 |
commit | b6b0194661303d12e9c73ffadbe82afe77c862e2 (patch) | |
tree | a8506effed9673e614baea438e5df0da6edf1a09 /ucb | |
parent | 5bbae1a8bc5a321f5855a50c2a98ae9128061786 (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
(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>
Diffstat (limited to 'ucb')
-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; } |