diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-01-19 15:22:19 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-01-19 15:22:19 -0600 |
commit | 3c2f3f48549f0566f7e0df3f66558833932c9d40 (patch) | |
tree | 94ea89b21eb4e7caccdcacc68446026959ef72c7 /basctl | |
parent | 2a77e7a310d3b9a62df3c475578e11373188e802 (diff) |
coverity#735598 : Division by zero
Change-Id: I288b46a933d8a301823deed8fccae9764b74e840
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 57379a70e28c..50590e689bd0 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -895,7 +895,9 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage ) // nLinepPage is not correct if there's a line break sal_uInt16 nLinespPage = (sal_uInt16) (aPaperSz.Height()/nLineHeight); - sal_uInt16 nCharspLine = (sal_uInt16) (aPaperSz.Width() / pPrinter->GetTextWidth( "X" ) ); + long nXTextWidth = pPrinter->GetTextWidth( "X" ); + + sal_uInt16 nCharspLine = (sal_uInt16) (aPaperSz.Width() / nXTextWidth > 1 ? nXTextWidth : 1); sal_uLong nParas = GetEditEngine()->GetParagraphCount(); sal_uInt16 nPages = (sal_uInt16) (nParas/nLinespPage+1 ); |