[Libreoffice-commits] core.git: sw/source
Caolán McNamara
caolanm at redhat.com
Sat Sep 23 18:25:35 UTC 2017
sw/source/uibase/docvw/PostItMgr.cxx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit 8bc6715a1a0ab43a1176c27a043f39c2dc587175
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Sep 23 17:10:32 2017 +0100
coverity#1418340 Division or modulo by zero
Change-Id: I0941f8db6b406c8ac316daef46b42e4694053410
Reviewed-on: https://gerrit.libreoffice.org/42696
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 0fbff0b9522b..90d11cec6ceb 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1062,7 +1062,9 @@ void SwPostItMgr::AutoScroll(const SwAnnotationWin* pPostIt,const unsigned long
mpEditWin->LogicToPixel(Point(0,mPages[aPage-1]->mPageRect.Bottom() - aSidebarheight)).Y() - (pPostIt->GetPosPixel().Y()+pPostIt->GetSizePixel().Height());
// this just adds the missing value to get the next a* GetScrollSize() after aDiff
// e.g aDiff= 61 POSTIT_SCROLL=50 --> lScroll = 100
- const long lScroll = bBottom ? (aDiff + ( GetScrollSize() - (aDiff % GetScrollSize()))) : (aDiff - (GetScrollSize() + (aDiff % GetScrollSize())));
+ const auto nScrollSize = GetScrollSize();
+ assert(nScrollSize);
+ const long lScroll = bBottom ? (aDiff + ( nScrollSize - (aDiff % nScrollSize))) : (aDiff - (nScrollSize + (aDiff % nScrollSize)));
Scroll(lScroll, aPage);
}
}
More information about the Libreoffice-commits
mailing list