Replace a segfault with an error message

This commit is contained in:
outfoxxed 2023-04-22 02:39:51 -07:00
parent bec2324b78
commit c90a3078c0
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E

View file

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