summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2011-11-23 15:44:01 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2011-11-23 15:44:01 -0500
commitf8625e8fba02136fcdac4685b85a3597eedf82e2 (patch)
tree35610902347aee24f02d922045982e437dcc57fd /sc/source
parentba897375db27a2b74ead5251516824572260b029 (diff)
Simplify it a bit.
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx13
1 files 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<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