[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Nov 23 12:44:06 PST 2011


 sc/source/ui/unoobj/docuno.cxx |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

New commits:
commit f8625e8fba02136fcdac4685b85a3597eedf82e2
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Nov 23 15:44:01 2011 -0500

    Simplify it a bit.

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 3bc1018..ab469b4 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2643,22 +2643,15 @@ sal_Int32 ScTableSheetsObj::importSheet(
     ScModelObj* pObj = ScModelObj::getImplementation(xDocSrc);
     ScDocShell* pDocShellSrc = static_cast<ScDocShell*>(pObj->GetEmbeddedObject());
 
-    SCTAB nIndexDest;
-    nIndexDest = -1;
-
     // SourceSheet Position and does srcName exists ?
     SCTAB nIndexSrc;
     if ( !pDocShellSrc->GetDocument()->GetTable( srcName, nIndexSrc ) )
         throw lang::IllegalArgumentException();
 
-    // control nDestPosition < maxtab
+    // Check the validity of destination index.
     SCTAB nCount = pDocDest->GetTableCount();
-    nIndexDest = static_cast<SCTAB>(nDestPosition);
-    if ( nIndexDest > nCount )
-        throw lang::IndexOutOfBoundsException();
-
-    // control nDestPosition > 0
-    if (nIndexDest < 0)
+    SCTAB nIndexDest = static_cast<SCTAB>(nDestPosition);
+    if (nIndexDest > nCount || nIndexDest < 0)
         throw lang::IndexOutOfBoundsException();
 
     // Transfert Tab


More information about the Libreoffice-commits mailing list