From c90a3078c04e74947ce835349954332355933791 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sat, 22 Apr 2023 02:39:51 -0700 Subject: [PATCH] Replace a segfault with an error message --- src/Hy3Layout.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp index 3083004..bd12c42 100644 --- a/src/Hy3Layout.cpp +++ b/src/Hy3Layout.cpp @@ -545,7 +545,13 @@ void Hy3Layout::onWindowRemovedTiling(CWindow* window) { CWindow* Hy3Layout::getNextWindowCandidate(CWindow* window) { auto* node = this->getWorkspaceRootGroup(window->m_iWorkspaceID); if (node == nullptr) return nullptr; - while (node->data.type == Hy3NodeData::Group) node = node->data.as_group.lastFocusedChild; + while (node->data.type == Hy3NodeData::Group) { + node = node->data.as_group.lastFocusedChild; + if (node == nullptr) { + Debug::log(ERR, "A group's last focused child was null when getting the next selection candidate"); + return nullptr; + } + } return node->data.as_window; }