summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-05-11 17:42:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-05-11 21:05:53 +0100
commita59a897fa542e40baf4991625c3f3cd66e20d088 (patch)
treec83a2c1867041064b01965e54fcff6b4507ee10e /sw
parent867aa217e6bcb543ea61c61f10088042d632bd07 (diff)
coverity#705435 Improper use of negative value
Change-Id: I590f7ae2b367242b5672d79b1c9c3d6661830564
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 68129234e555..5f86a02e4a14 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2447,7 +2447,16 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
// new left margin = old left + label space
const SwNumRule* pRule = rNode.GetNumRule();
- const SwNumFmt& rNumFmt = pRule->Get( static_cast< sal_uInt16 >(rNode.GetActualListLevel()) );
+ int nLevel = rNode.GetActualListLevel();
+
+ if (nLevel < 0)
+ nLevel = 0;
+
+ if (nLevel >= MAXLEVEL)
+ nLevel = MAXLEVEL - 1;
+
+ const SwNumFmt& rNumFmt = pRule->Get( static_cast< sal_uInt16 >(nLevel) );
+
// #i86652#
if ( rNumFmt.GetPositionAndSpaceMode() ==
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )