Skip to content

Commit

Permalink
Merge pull request #139 from thinkSJ/master
Browse files Browse the repository at this point in the history
fixed a crash bug in qhexedit.cpp
  • Loading branch information
Simsys authored Oct 23, 2022
2 parents f40a4f2 + d314aab commit 46b8573
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/qhexedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 46b8573

Please sign in to comment.