From b366748ad4f8f4c95d2d9c5f128c6c2e593a39ae Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 10 Jan 2025 21:37:24 +0800 Subject: [PATCH] fix --- src/managers/KeybindManager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index b0bd0e9c069..4cd97913e81 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -983,7 +983,14 @@ uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWo } SDispatchResult CKeybindManager::killActive(std::string args) { - kill(g_pCompositor->m_pLastWindow.lock()->getPID(), SIGKILL); + const auto PWINDOW = g_pCompositor->m_pLastWindow.lock(); + + if (!PWINDOW) { + Debug::log(ERR, "killActive: no window found"); + return {.success = false, .error = "killActive: no window found"}; + } + + kill(PWINDOW->getPID(), SIGKILL); return {}; }