From ffacd2efd1ca7fdf364a519c9d8d8644da28412b Mon Sep 17 00:00:00 2001 From: vaxerski Date: Mon, 25 Sep 2023 15:00:19 +0100 Subject: [PATCH] hyprctl: fix crash in unsafe state with activeworkspace fixes #3419 --- src/debug/HyprCtl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index f37b24e6..0aafe664 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -228,8 +228,15 @@ static std::string getWorkspaceData(CWorkspace* w, HyprCtl::eHyprCtlOutputFormat } std::string activeWorkspaceRequest(HyprCtl::eHyprCtlOutputFormat format) { + if (!g_pCompositor->m_pLastMonitor) + return "unsafe state"; + std::string result = ""; auto w = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace); + + if (!w) + return "internal error"; + return getWorkspaceData(w, format); }