From 70f4321a9321c9eaf9afaba8b81ff28633634a72 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 25 Jun 2024 18:34:44 +0200 Subject: [PATCH] drm/legacy: fix crash on null mode commit --- src/backend/drm/impl/Legacy.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backend/drm/impl/Legacy.cpp b/src/backend/drm/impl/Legacy.cpp index 368fee9..2f6079b 100644 --- a/src/backend/drm/impl/Legacy.cpp +++ b/src/backend/drm/impl/Legacy.cpp @@ -41,9 +41,12 @@ bool Aquamarine::CDRMLegacyImpl::commitInternal(Hyprutils::Memory::CSharedPointe mode = (drmModeModeInfo*)&data.modeInfo; } - connector->backend->backend->log( - AQ_LOG_DEBUG, - std::format("legacy drm: Modesetting CRTC, mode: clock {} hdisplay {} vdisplay {} vrefresh {}", mode->clock, mode->hdisplay, mode->vdisplay, mode->vrefresh)); + if (mode) { + connector->backend->backend->log( + AQ_LOG_DEBUG, + std::format("legacy drm: Modesetting CRTC, mode: clock {} hdisplay {} vdisplay {} vrefresh {}", mode->clock, mode->hdisplay, mode->vdisplay, mode->vrefresh)); + } else + connector->backend->backend->log(AQ_LOG_DEBUG, "legacy drm: Modesetting CRTC, mode null"); if (auto ret = drmModeSetCrtc(connector->backend->gpu->fd, connector->crtc->id, mainFB ? mainFB->id : -1, 0, 0, connectors.data(), connectors.size(), mode); ret) { connector->backend->backend->log(AQ_LOG_ERROR, std::format("legacy drm: drmModeSetCrtc failed: {}", strerror(-ret)));