From 4a83b67e3c3dc8bceb6602ce155f2463f72f4855 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 5 Nov 2014 16:10:18 +0000 Subject: coverity#735652 Division or modulo by zero and coverity#735651 Division or modulo by zero Change-Id: I412308ef3e736b1e9c72d1dd3a8d80d2dce92d67 --- sw/source/uibase/uiview/srcview.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sw') 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(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(aPaperSz.Width() / nCharWidth) : 1; const sal_uLong nParas = pTextEngine->GetParagraphCount(); const sal_Int32 nPages = static_cast(nParas / nLinespPage + 1 ); -- cgit