diff --git a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp index 5a58d6d7509..dcc4ad5c7a0 100644 --- a/src/plugins/platforms/wayland/qwaylandinputcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputcontext.cpp @@ -532,7 +532,8 @@ void QWaylandInputContext::setFocusObject(QObject *) if (mCurrentWindow && mCurrentWindow->handle()) { if (mCurrentWindow.data() != window || !inputMethodAccepted()) { struct ::wl_surface *surface = static_cast(mCurrentWindow->handle())->object(); - textInput()->disable(surface); + if (surface) + textInput()->disable(surface); mCurrentWindow.clear(); } }