Debugger: Create check for successful QString conversion in MemoryViewerWidget.cpp

This commit is contained in:
TheTechnician27 2024-02-01 01:11:15 -06:00 committed by refractionpcsx2
parent dccba86dde
commit 88672dc38f
1 changed files with 3 additions and 1 deletions

View File

@ -277,9 +277,11 @@ bool MemoryViewTable::KeyPress(int key, QChar keychar)
if (keyCharIsText)
{
InsertIntoSelectedHexView(((u8)QString(QChar(key)).toInt(&pressHandled, 16)));
// Check if key pressed is hex before insertion (QString conversion fails otherwise)
const u8 keyPressed = (u8)QString(QChar(key)).toInt(&pressHandled, 16);
if (pressHandled)
{
InsertIntoSelectedHexView(keyPressed);
// Increment to the next nibble or byte
if ((selectedNibbleHI = !selectedNibbleHI))
UpdateSelectedAddress(selectedAddress + 1);