datadevice: guard XWayland server against crashes

The server might be dead or restarting, and we'd deref null

ref #7822
This commit is contained in:
Vaxry 2025-01-06 15:27:57 +01:00
parent f390f48a07
commit f1a7a7497e

View file

@ -417,7 +417,7 @@ void CWLDataDeviceProtocol::destroyResource(CWLDataOfferResource* resource) {
SP<IDataDevice> CWLDataDeviceProtocol::dataDeviceForClient(wl_client* c) { SP<IDataDevice> CWLDataDeviceProtocol::dataDeviceForClient(wl_client* c) {
#ifndef NO_XWAYLAND #ifndef NO_XWAYLAND
if (c == g_pXWayland->pServer->xwaylandClient) if (g_pXWayland->pServer && c == g_pXWayland->pServer->xwaylandClient)
return g_pXWayland->pWM->getDataDevice(); return g_pXWayland->pWM->getDataDevice();
#endif #endif