keybinds: fix nullptr deref in forcekillactive (#9021)

This commit is contained in:
littleblack111 2025-01-10 23:16:52 +08:00 committed by GitHub
parent 8475a8ef99
commit da9252a23e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -983,7 +983,14 @@ uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWo
} }
SDispatchResult CKeybindManager::killActive(std::string args) { 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 {}; return {};
} }