summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-03-20 16:41:29 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-03-21 08:54:43 +0000
commitee948846df6e880e7b421e0ef36367849ae0004e (patch)
tree79d6f0d532aabbe8460b2d37ed08f6f86e50a91c /sw
parenta0245173b0352e0032013b39b124a02c76d23786 (diff)
coverity#705430 Improper use of negative value
Change-Id: Ia97bc71328d095f7f36d1d53027bd2bb16a9a60f
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index e866049d5a3c..e212d558524e 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2996,7 +2996,15 @@ long SwTxtNode::GetLeftMarginForTabCalculation() const
const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0;
if( pRule )
{
- const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(GetActualListLevel()));
+ int nLevel = GetActualListLevel();
+
+ if (nLevel < 0)
+ nLevel = 0;
+
+ if (nLevel >= MAXLEVEL)
+ nLevel = MAXLEVEL - 1;
+
+ const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(nLevel));
if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
if ( AreListLevelIndentsApplicable() )