summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 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)