summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-10-09 16:27:28 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-10-09 16:59:51 +0100
commit9692c7d285f85dd8a90cf156ff212969bc79135b (patch)
treeedd5ea73c1e1b6e6c7bca2b2396fe3cd17675083 /sw/source/core/txtnode
parent540e817e7b59953d1036cdbdf1c47358b6ed98be (diff)
CID#736197 out of bounds
Change-Id: I9b105926b812e4341700d87d77288fe429beda53
Diffstat (limited to 'sw/source/core/txtnode')
-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 e002cee8d4b3..489524217cb7 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2729,7 +2729,15 @@ long SwTxtNode::GetLeftMarginWithNum( sal_Bool bTxtLeft ) const
const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L;
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_WIDTH_AND_POSITION )
{