Wasm: fix QtVirtualKeyboard crash

Do not try to access non the existent input element when there is no touchscreen,
as we do not use it in that instance.

Fixes: QTBUG-125120
Pick-to: 6.7 6.7.1
Change-Id: Iedac1890d13b348ef12690947779347e3c2f8476
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
This commit is contained in:
Lorn Potter 2024-05-07 09:06:44 +10:00
parent 877e77eced
commit 41cb01dc59

View File

@ -128,9 +128,8 @@ QWasmWindow::QWasmWindow(QWindow *w, QWasmDeadKeySupport *deadKeySupport,
});
emscripten::val keyFocusWindow;
if (QWasmIntegration::get()->inputContext()) {
QWasmInputContext *wasmContext =
static_cast<QWasmInputContext *>(QWasmIntegration::get()->inputContext());
if (QWasmInputContext *wasmContext =
qobject_cast<QWasmInputContext *>(QWasmIntegration::get()->inputContext())) {
// if there is an touchscreen input context,
// use that window for key input
keyFocusWindow = wasmContext->m_inputElement;