summaryrefslogtreecommitdiff
path: root/sw/source/uibase/docvw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-09-23 17:10:32 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-09-23 20:25:01 +0200
commit8bc6715a1a0ab43a1176c27a043f39c2dc587175 (patch)
treeff19d8cf2c4b113a80349c51f9089194f52da6bd /sw/source/uibase/docvw
parentaf030e8826e6d5fc8fdd2b00b995bb782564cade (diff)
coverity#1418340 Division or modulo by zero
Change-Id: I0941f8db6b406c8ac316daef46b42e4694053410 Reviewed-on: https://gerrit.libreoffice.org/42696 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/docvw')
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx4
1 files changed, 3 insertions, 1 deletions
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);
}
}