From f8625e8fba02136fcdac4685b85a3597eedf82e2 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 23 Nov 2011 15:44:01 -0500 Subject: Simplify it a bit. --- sc/source/ui/unoobj/docuno.cxx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 3bc1018c000c..ab469b4c1be6 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(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(nDestPosition); - if ( nIndexDest > nCount ) - throw lang::IndexOutOfBoundsException(); - - // control nDestPosition > 0 - if (nIndexDest < 0) + SCTAB nIndexDest = static_cast(nDestPosition); + if (nIndexDest > nCount || nIndexDest < 0) throw lang::IndexOutOfBoundsException(); // Transfert Tab -- cgit