blob: 9c3099b06d28c27f8bb7454e33a5dff448453eaa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
https://github.com/Simsys/qhexedit2/pull/139
From d314aab25eeab0db131fc87f20daf7c4ad587ee2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=AF=B7=E5=8F=AB=E6=88=91=E8=88=B9=E9=95=BF?=
<38233142+thinkSJ@users.noreply.github.com>
Date: Sat, 13 Nov 2021 18:35:25 +0800
Subject: [PATCH] Update qhexedit.cpp
crashed when press ctrl alt keys....
---
src/qhexedit.cpp | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/qhexedit.cpp b/src/qhexedit.cpp
index d7e532c..4137192 100644
--- a/src/qhexedit.cpp
+++ b/src/qhexedit.cpp
@@ -766,11 +766,15 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
(QApplication::keyboardModifiers() == Qt::GroupSwitchModifier))
{
/* Hex and ascii input */
- int key;
- if (_editAreaIsAscii)
- key = (uchar)event->text().at(0).toLatin1();
- else
- key = int(event->text().at(0).toLower().toLatin1());
+ int key = 0;
+ QString text = event->text();
+ if (!text.isEmpty())
+ {
+ if (_editAreaIsAscii)
+ key = (uchar)text.at(0).toLatin1();
+ else
+ key = int(text.at(0).toLower().toLatin1());
+ }
if ((((key >= '0' && key <= '9') || (key >= 'a' && key <= 'f')) && _editAreaIsAscii == false)
|| (key >= ' ' && _editAreaIsAscii))
|