summaryrefslogtreecommitdiff
path: root/src/debug/HyprCtl.cpp
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2023-09-25 15:00:19 +0100
committervaxerski <vaxry@vaxry.net>2023-09-25 15:00:28 +0100
commitffacd2efd1ca7fdf364a519c9d8d8644da28412b (patch)
tree4bf0ef6f903bc5a7455901dbec74f044f9c28547 /src/debug/HyprCtl.cpp
parent3b657257ecb7628a12a4fe72e733a60f031bfec2 (diff)
hyprctl: fix crash in unsafe state with activeworkspace
fixes #3419
Diffstat (limited to 'src/debug/HyprCtl.cpp')
-rw-r--r--src/debug/HyprCtl.cpp7
1 files changed, 7 insertions, 0 deletions
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);
}