Don't index into empty QString in HexEditor.

QKeyEvent::text may return an empty string in some environments for some keys,
such as modifier keys. This can cause a cause a crash. Add a check for the
hex editor to skip the editing code, which assumes the keyboard event is a
printable character and depends on a non-empty keyboard event text.
This commit is contained in:
Fritz Mahnke 2023-04-17 08:28:37 -07:00
parent 771bccd820
commit f885abb71b
1 changed files with 7 additions and 1 deletions

View File

@ -2777,7 +2777,13 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
event->accept();
}
else
{
{ // Use the input text to modify the values in the editor area.
if (event->text().isEmpty())
{
return;
}
int key;
if ( cursorPosX >= 32 )
{ // Edit Area is ASCII