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};