mirror of
https://github.com/SerenityOS/serenity
synced 2024-11-05 17:46:52 +00:00
Ladybird: Fix some crashes related to keyboard events
Don't try to get the unicode value of an empty string.
This commit is contained in:
parent
ef757f33da
commit
0a38d246f9
1 changed files with 10 additions and 3 deletions
|
@ -602,18 +602,25 @@ void WebView::keyPressEvent(QKeyEvent* event)
|
|||
break;
|
||||
}
|
||||
|
||||
auto text = event->text();
|
||||
if (text.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
auto point = event->text()[0].unicode();
|
||||
auto keycode = get_keycode_from_qt_keyboard_event(*event);
|
||||
auto modifiers = get_modifiers_from_qt_keyboard_event(*event);
|
||||
auto point = event->text()[0].unicode();
|
||||
// dbgln(String::formatted("keycode={}, modifiers={}, point={}", (int32_t)keycode, modifiers, point));
|
||||
m_page_client->page().handle_keydown(keycode, modifiers, point);
|
||||
}
|
||||
|
||||
void WebView::keyReleaseEvent(QKeyEvent* event)
|
||||
{
|
||||
auto text = event->text();
|
||||
if (text.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
auto point = event->text()[0].unicode();
|
||||
auto keycode = get_keycode_from_qt_keyboard_event(*event);
|
||||
auto modifiers = get_modifiers_from_qt_keyboard_event(*event);
|
||||
auto point = event->text()[0].unicode();
|
||||
m_page_client->page().handle_keyup(keycode, modifiers, point);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue