summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-11-18 17:29:43 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-11-18 17:29:43 +0100
commit66da98c931e28ed910bac5b45b6d0a794196b6f0 (patch)
tree4cb85cc73351ce6a2dd11ec0ef4987bf7f88bce3 /sd
parent14af38f429f84a75a9dae60d74d41c57efd709f6 (diff)
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
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/dlg/headerfooterdlg.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx
index fa7bdf9bb3f9..612659473c99 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;