diff --git a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp index 9dbef8d5bf0..e7afc3ca8d8 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevice.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevice.cpp @@ -113,7 +113,10 @@ void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon) if (!origin) origin = seat->touchFocus(); - start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial()); + if (origin) + start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial()); + else + qCDebug(lcQpaWayland) << "Couldn't start a drag because the origin window could not be found."; } void QWaylandDataDevice::cancelDrag() diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 6ebc3bed748..19e36ccba63 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -279,6 +279,10 @@ void QWaylandInputDevice::Pointer::updateCursorTheme() int pixelSize = cursorSize() * scale; auto *display = seat()->mQDisplay; mCursor.theme = display->loadCursorTheme(cursorThemeName(), pixelSize); + + if (!mCursor.theme) + return; // A warning has already been printed in loadCursorTheme + if (auto *arrow = mCursor.theme->cursorImage(Qt::ArrowCursor)) { int arrowPixelSize = qMax(arrow->width, arrow->height); // Not all cursor themes are square while (scale > 1 && arrowPixelSize / scale < cursorSize()) @@ -317,6 +321,9 @@ void QWaylandInputDevice::Pointer::updateCursor() if (!mCursor.theme || idealCursorScale() != mCursor.themeBufferScale) updateCursorTheme(); + if (!mCursor.theme) + return; + // Set from shape using theme uint time = seat()->mCursor.animationTimer.elapsed(); if (struct ::wl_cursor_image *image = mCursor.theme->cursorImage(shape, time)) {