diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index a4a81dc3ebe..a0cd01a9135 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -147,19 +147,18 @@ CKeybindManager::CKeybindManager() { m_pRepeatKeyTimer = makeShared( std::nullopt, [this](SP self, void* data) { + if (m_vActiveKeybinds.size() == 0 || g_pSeatManager->keyboard.expired()) + return; - if (m_vActiveKeybinds.size() == 0 || g_pSeatManager->keyboard.expired()) - return; - - for (SKeybind* k : m_vActiveKeybinds) { - const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find(k->handler); + for (SKeybind* k : m_vActiveKeybinds) { + const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find(k->handler); - Debug::log(LOG, "Keybind repeat triggered, calling dispatcher."); - DISPATCHER->second(k->arg); - } + Debug::log(LOG, "Keybind repeat triggered, calling dispatcher."); + DISPATCHER->second(k->arg); + } - const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock(); - self->updateTimeout(std::chrono::milliseconds(1000 / PACTIVEKEEB->repeatRate)); + const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock(); + self->updateTimeout(std::chrono::milliseconds(1000 / PACTIVEKEEB->repeatRate)); }, nullptr); diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp index ccbbce6c6af..d375db0fd68 100644 --- a/src/managers/KeybindManager.hpp +++ b/src/managers/KeybindManager.hpp @@ -120,7 +120,7 @@ class CKeybindManager { inline static std::string m_szCurrentSelectedSubmap = ""; std::vector m_vActiveKeybinds; - SKeybind * m_pLastLongPressKeybind = nullptr; + SKeybind* m_pLastLongPressKeybind = nullptr; SP m_pLongPressTimer, m_pRepeatKeyTimer; uint32_t m_uTimeLastMs = 0;