summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-01-10 23:16:52 +0800
committerGitHub <noreply@github.com>2025-01-10 15:16:52 +0000
commitda9252a23e69fc4d34beca73ebcc90b03af0ed2a (patch)
tree6f387551204b06f46d06b642934b6bb1c6a43eab /src/managers/KeybindManager.cpp
parent8475a8ef992fd45be41b3217ac0f0dd71235f257 (diff)
keybinds: fix nullptr deref in forcekillactive (#9021)
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index b0bd0e9c..4cd97913 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 {};
}