1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-18 01:30:56 +00:00

Ensures no out-of-bounds access for unlabelled keys.

This commit is contained in:
Thomas Harte 2020-06-21 17:11:24 -04:00
parent a03211c410
commit 68d4d7d10a

View File

@ -104,8 +104,7 @@ void MainWindow::newFile() {
other->show(); other->show();
} }
void MainWindow::tile(const QMainWindow *previous) void MainWindow::tile(const QMainWindow *previous) {
{
// This entire function is essentially verbatim from the Qt SDI example. // This entire function is essentially verbatim from the Qt SDI example.
if (!previous) if (!previous)
return; return;
@ -457,7 +456,7 @@ bool MainWindow::processEvent(QKeyEvent *event) {
} }
std::unique_lock lock(machineMutex); std::unique_lock lock(machineMutex);
keyboardMachine->get_keyboard().set_key_pressed(key, event->text()[0].toLatin1(), event->type() == QEvent::KeyPress); keyboardMachine->get_keyboard().set_key_pressed(key, event->text().size() ? event->text()[0].toLatin1() : '\0', event->type() == QEvent::KeyPress);
return false; return false;
} }