diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index cd0ea52d77..bea8c6dc57 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -1325,8 +1325,12 @@ std::optional ScreenPanelGL::getWindowInfo() else if (platform_name == QStringLiteral("wayland")) { wi.type = WindowInfo::Type::Wayland; - wi.display_connection = pni->nativeResourceForWindow("display", windowHandle()); - wi.window_handle = pni->nativeResourceForWindow("surface", windowHandle()); + QWindow* handle = windowHandle(); + if (handle == nullptr) + return std::nullopt; + + wi.display_connection = pni->nativeResourceForWindow("display", handle); + wi.window_handle = pni->nativeResourceForWindow("surface", handle); } else {