summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 949164a..d5a7afd 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -262,12 +262,14 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
int col = 0;
for (int w = 0; e->x() >= w; col++)
if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys
w += keys->width(row,col) * defaultKeyWidth;
else break;
+ if (col <= 0) return;
+
col --; // rewind one...
qkeycode = keys->qcode(row, col);
unicode = keys->uni(row, col);
// might need to repaint if two or more of the same keys.