Fix crash on single window group

This commit is contained in:
ItsDrike 2023-10-03 20:49:32 +02:00
parent 49b45918db
commit ab36aeeae7
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -108,9 +108,13 @@ void newCreateGroup(CWindow* self)
// Collect all child dwindle nodes, we'll want to add all of those into a group // Collect all child dwindle nodes, we'll want to add all of those into a group
const auto P_DWINDLE_NODE = g_pNodeFromWindow(pDwindleLayout, self); const auto P_DWINDLE_NODE = g_pNodeFromWindow(pDwindleLayout, self);
const auto P_PARENT_NODE = P_DWINDLE_NODE->pParent;
if (!P_PARENT_NODE) {
Debug::log(LOG, "[dwindle-autogroup] Ignoring autogroup for a single window");
return;
}
const auto P_SIBLING_NODE = P_PARENT_NODE->children[0] == P_DWINDLE_NODE ? P_PARENT_NODE->children[1] : P_PARENT_NODE->children[0];
std::deque<SDwindleNodeData*> p_dDwindleNodes; std::deque<SDwindleNodeData*> p_dDwindleNodes;
const auto P_SIBLING_NODE =
P_DWINDLE_NODE->pParent->children[0] == P_DWINDLE_NODE ? P_DWINDLE_NODE->pParent->children[1] : P_DWINDLE_NODE->pParent->children[0];
collectDwindleChildNodes(&p_dDwindleNodes, P_SIBLING_NODE); collectDwindleChildNodes(&p_dDwindleNodes, P_SIBLING_NODE);
// Stop if one of the dwindle child nodes is already in a group // Stop if one of the dwindle child nodes is already in a group