summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-11-05 16:10:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-11-05 21:03:24 +0000
commit4a83b67e3c3dc8bceb6602ce155f2463f72f4855 (patch)
tree6f62ae750a4157380b9d9e9b625ab8c4aecf1dde
parent42019e2f25235f69ac5f8efdabedd99fca32f1a1 (diff)
coverity#735652 Division or modulo by zero
and coverity#735651 Division or modulo by zero Change-Id: I412308ef3e736b1e9c72d1dd3a8d80d2dce92d67
-rw-r--r--sw/source/uibase/uiview/srcview.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 0a218517202a..9ba50daa59c4 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -721,9 +721,9 @@ sal_Int32 SwSrcView::PrintSource(
aPaperSz.Height() -= (TMARGPRN + BMARGPRN);
// nLinepPage is not true, if lines have to be wrapped...
- const long nLinespPage = aPaperSz.Height() / nLineHeight;
- const sal_Int32 nCharspLine =
- static_cast<sal_Int32>(aPaperSz.Width() / pOutDev->GetTextWidth("X"));
+ const long nLinespPage = nLineHeight ? aPaperSz.Height() / nLineHeight : 1;
+ const long nCharWidth = pOutDev->GetTextWidth("X");
+ const sal_Int32 nCharspLine = nCharWidth ? static_cast<sal_Int32>(aPaperSz.Width() / nCharWidth) : 1;
const sal_uLong nParas = pTextEngine->GetParagraphCount();
const sal_Int32 nPages = static_cast<sal_Int32>(nParas / nLinespPage + 1 );