diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-08-08 16:24:29 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-08-08 21:58:46 +0200 |
commit | 729c29f3bef16ea85fd8ce7aa32a010a204589ad (patch) | |
tree | cdfcf3b4aa4f08d0fc535e6e5e53dd2e44bfe065 /sd/source | |
parent | 469414e66f2b55c06439aaf062aa6dae66ef3096 (diff) |
sd: avoid divide by zero in FuZoom::MouseMove
See https://crashreport.libreoffice.org/stats/signature/sd::FuZoom::MouseMove(MouseEvent%20const%20&)
Change-Id: I3b07def2ba088a92e2358e7db57c27c047165cef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137988
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/func/fuzoom.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sd/source/ui/func/fuzoom.cxx b/sd/source/ui/func/fuzoom.cxx index aa5395267183..871d594d3368 100644 --- a/sd/source/ui/func/fuzoom.cxx +++ b/sd/source/ui/func/fuzoom.cxx @@ -117,10 +117,14 @@ bool FuZoom::MouseMove(const MouseEvent& rMEvt) { Size aWorkSize = mpView->GetWorkArea().GetSize(); Size aPageSize = mpView->GetSdrPageView()->GetPage()->GetSize(); - aScroll.setX( aScroll.X() / ( aWorkSize.Width() / aPageSize.Width()) ); - aScroll.setY( aScroll.Y() / ( aWorkSize.Height() / aPageSize.Height()) ); - mpViewShell->Scroll(aScroll.X(), aScroll.Y()); - aBeginPosPix = aPosPix; + if (aWorkSize.Width() != 0 && aWorkSize.Height() != 0 && + aPageSize.Width() != 0 && aPageSize.Height() != 0) + { + aScroll.setX( aScroll.X() / ( aWorkSize.Width() / aPageSize.Width()) ); + aScroll.setY( aScroll.Y() / ( aWorkSize.Height() / aPageSize.Height()) ); + mpViewShell->Scroll(aScroll.X(), aScroll.Y()); + aBeginPosPix = aPosPix; + } } } else |