summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-05-24 21:49:20 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-05-25 12:10:00 +0200
commit23e3bff528ab38c8d5c6d401b672a0033cef2bd4 (patch)
tree2010206217505c63cd5ea19d3874851f89c06b31
parent969603ffa48c6566b602a2a9174fc0acea307428 (diff)
svx: fix one more EXCEPTION_INT_DIVIDE_BY_ZERO
See https://crashreport.libreoffice.org/stats/signature/SvxShowCharSet::PixelToMapIndex(Point%20const%20&) Change-Id: Ied5698fd47220fae54d72be263c3eeed5fb77911 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134890 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--svx/source/dialog/charmap.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index b806903ee184..d7a7898d5342 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -376,7 +376,9 @@ Point SvxShowCharSet::MapIndexToPixel( int nIndex ) const
int SvxShowCharSet::PixelToMapIndex( const Point& point) const
{
int nBase = FirstInView();
- return (nBase + ((point.X() - m_nXGap)/nX) + ((point.Y() - m_nYGap)/nY) * COLUMN_COUNT);
+ int x = nX == 0 ? 0 : (point.X() - m_nXGap)/nX;
+ int y = nY == 0 ? 0 : (point.Y() - m_nYGap)/nY;
+ return (nBase + x + y * COLUMN_COUNT);
}
bool SvxShowCharSet::KeyInput(const KeyEvent& rKEvt)