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

Eike Rathke erack at redhat.com
Fri Jan 26 12:42:59 UTC 2018


 sc/source/core/data/documen3.cxx |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 707e0f4e6b6e36432c0f04f22719428a7e1a50ee
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Jan 26 13:41:09 2018 +0100

    coverity#1428613 check IsValidReference() return value, tdf#108989 follow-up
    
    Also remove the unnecessary continue;break; construct and just
    return if found.
    
    Change-Id: Ib32ff214a1a24ef3ad3c6f7f659a8b7fde6b2d4a

diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index f7f8687ca4b2..e5262cd23d89 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -212,7 +212,6 @@ bool ScDocument::IsAddressInRangeName( RangeNameScope eScope, ScAddress& rAddres
 {
     ScRangeName* pRangeNames;
     ScRange aNameRange;
-    bool bRet = false;
 
     if (eScope == RangeNameScope::GLOBAL)
         pRangeNames= GetRangeName();
@@ -223,15 +222,14 @@ bool ScDocument::IsAddressInRangeName( RangeNameScope eScope, ScAddress& rAddres
 
     for (ScRangeName::iterator itr = itrBegin; itr != itrEnd; ++itr)
     {
-        itr->second->IsValidReference(aNameRange);
-        bRet = aNameRange.In(rAddress);
-        if (!bRet)
-            continue;
-        else
-            break;
+        if (itr->second->IsValidReference(aNameRange))
+        {
+            if (aNameRange.In(rAddress))
+                return true;
+        }
     }
 
-    return bRet;
+    return false;
 }
 
 bool ScDocument::InsertNewRangeName( const OUString& rName, const ScAddress& rPos, const OUString& rExpr )


More information about the Libreoffice-commits mailing list