[Libreoffice-commits] core.git: sd/source

Stephan Bergmann sbergman at redhat.com
Fri Nov 18 16:31:13 UTC 2016


 sd/source/ui/dlg/headerfooterdlg.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 66da98c931e28ed910bac5b45b6d0a794196b6f0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Nov 18 17:29:43 2016 +0100

    Avoid division by zero
    
    ...as happens during CppunitTest_sd_dialogs_test when displaying
    modules/simpress/ui/headerfootertab.ui:
    
    > sd/source/ui/dlg/headerfooterdlg.cxx:782:63: runtime error: division by zero
    >     #0 0x7f270dc78b7f in sd::PresLayoutPreview::Paint(OutputDevice&, Rectangle const&) sd/source/ui/dlg/headerfooterdlg.cxx:782:63
    >     #1 0x7f274a56bb53 in PaintHelper::DoPaint(vcl::Region const*) vcl/source/window/paint.cxx:307:24
    >     #2 0x7f274a57be32 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:613:17
    >     #3 0x7f274a577eee in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:547:30
    >     #4 0x7f274a57c305 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:619:1
    >     #5 0x7f274a577eee in PaintHelper::~PaintHelper() vcl/source/window/paint.cxx:547:30
    >     #6 0x7f274a57c305 in vcl::Window::ImplCallPaint(vcl::Region const*, unsigned short) vcl/source/window/paint.cxx:619:1
    >     #7 0x7f274a589f0d in vcl::Window::Update() vcl/source/window/paint.cxx:1310:24
    >     #8 0x7f274b908d23 in ImplHandlePaint(vcl::Window*, Rectangle const&, bool) vcl/source/window/winproc.cxx:1593:18
    >     #9 0x7f274b8f9092 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) vcl/source/window/winproc.cxx:2437:13
    >     #10 0x7f272e3c8662 in SalFrame::CallCallback(SalEvent, void const*) const vcl/inc/salframe.hxx:276:33
    
    Change-Id: I2868a8b0a726544c9edbaab62a8929badf6d3845

diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx
index fa7bdf9..6126594 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -774,12 +774,12 @@ void PresLayoutPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangl
     if( maPageSize.Width() > maPageSize.Height() )
     {
         nWidth = maOutRect.GetWidth();
-        nHeight = long( (double)(nWidth * maPageSize.Height()) / (double)maPageSize.Width() );
+        nHeight = maPageSize.Width() == 0 ? 0 : long( (double)(nWidth * maPageSize.Height()) / (double)maPageSize.Width() );
     }
     else
     {
         nHeight = maOutRect.GetHeight();
-        nWidth = long( (double)(nHeight * maPageSize.Width()) / (double)maPageSize.Height() );
+        nWidth = maPageSize.Height() == 0 ? 0 : long( (double)(nHeight * maPageSize.Width()) / (double)maPageSize.Height() );
     }
 
     maOutRect.Left() += (maOutRect.GetWidth() - nWidth) >> 1;


More information about the Libreoffice-commits mailing list