svx/source/dialog/charmap.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
New commits: commit 69d213526f3c1a6c08c5be8c35a9f8bcc02bf178 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue May 24 21:49:20 2022 +0200 Commit: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> CommitDate: Wed Jun 1 22:45:18 2022 +0200 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/+/134899 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 663abd7162c29d289f84781eac56ca2c28b3a356) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134909 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index 5736ea26ce73..5b1abbc5730c 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -375,7 +375,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)