From 49686f96c7b8167be71710694c29ef6a1b97adff Mon Sep 17 00:00:00 2001 From: Visal Vijay <150381094+B2krobbery@users.noreply.github.com> Date: Sat, 4 Apr 2026 18:06:58 +0530 Subject: [PATCH] miscfunctions: reuse monitor pointer instead of repeated calls (#13977) --- src/helpers/MiscFunctions.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index 2a200f1e5..71616ebf9 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -173,10 +173,11 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) { } } } else if (in.starts_with("prev")) { - if (!Desktop::focusState()->monitor()) + auto monitor = Desktop::focusState()->monitor(); + if (!monitor) return {WORKSPACE_INVALID}; - const auto PWORKSPACE = Desktop::focusState()->monitor()->m_activeWorkspace; + const auto PWORKSPACE = monitor->m_activeWorkspace; if (!valid(PWORKSPACE)) return {WORKSPACE_INVALID};