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

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 15 09:15:42 UTC 2020


 sw/source/core/inc/unoport.hxx        |    3 +--
 sw/source/core/unocore/unoredline.cxx |   13 +++++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit cca02a2fbdbcc6f178c05543b0315fe8e1ade812
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Sep 14 18:59:05 2020 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Tue Sep 15 11:15:00 2020 +0200

    sw: don't throw if disposed in SwXRedlinePortion::getPropertyValue()
    
    No other SwXTextPortion method does that, so avoid it here for
    consistency, just return void.
    
    Change-Id: Iae9b6b12e21609e315a9f269feb0703657bbf3cd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102691
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx
index 7817d7d16d36..69c407d5b135 100644
--- a/sw/source/core/inc/unoport.hxx
+++ b/sw/source/core/inc/unoport.hxx
@@ -273,8 +273,7 @@ class SwXRedlinePortion : public SwXTextPortion
 private:
     SwRangeRedline const& m_rRedline;
 
-    /// @throws css::uno::RuntimeException
-    void Validate();
+    bool Validate();
 
     using SwXTextPortion::GetPropertyValue;
 
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index 615b1b04c4b4..4ba69d93b553 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -197,7 +197,10 @@ static uno::Sequence<beans::PropertyValue> lcl_GetSuccessorProperties(const SwRa
 uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName )
 {
     SolarMutexGuard aGuard;
-    Validate();
+    if (!Validate())
+    {
+        return uno::Any();
+    }
     uno::Any aRet;
     if(rPropertyName == UNO_NAME_REDLINE_TEXT)
     {
@@ -225,7 +228,7 @@ uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName )
     return aRet;
 }
 
-void SwXRedlinePortion::Validate()
+bool SwXRedlinePortion::Validate()
 {
     SwUnoCursor& rUnoCursor = GetCursor();
     //search for the redline
@@ -233,9 +236,11 @@ void SwXRedlinePortion::Validate()
     const SwRedlineTable& rRedTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
     bool bFound = false;
     for(size_t nRed = 0; nRed < rRedTable.size() && !bFound; nRed++)
+    {
         bFound = &m_rRedline == rRedTable[nRed];
-    if(!bFound)
-        throw uno::RuntimeException();
+    }
+    return bFound;
+    // don't throw; the only caller can return void instead
 }
 
 uno::Sequence< sal_Int8 > SAL_CALL SwXRedlinePortion::getImplementationId(  )


More information about the Libreoffice-commits mailing list