[Libreoffice-commits] core.git: ucb/source

Michael Stahl mstahl at redhat.com
Mon Jan 9 18:01:11 UTC 2017


 ucb/source/ucp/cmis/cmis_datasupplier.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 84de69638362c7b575560e0da3efbc709b7ac476
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jan 9 18:42:22 2017 +0100

    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

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;
     }


More information about the Libreoffice-commits mailing list