fix(pane_tree): prevent nil pane access in symmetric layouts #127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #98 - Resolves nil pane access error that occurs during workspace switching with symmetric pane layouts
Problem
When saving workspace state with symmetric pane layouts (e.g., 2x2 grid or perfect cross layout), the following error occurs:
attempt to index a nil value (field 'pane')
at pane_tree.lua:85 in root.pane:get_domain_name()
Root Cause
In the recursive
insert_panes()function, symmetric pane layouts can cause the same pane node to be encountered multiple times through different branches:root.paneis set tonil(line 122) to avoid memory leaksroot.pane:get_domain_name()on the already-nil pane causes the crashThis happens because in symmetric layouts, a pane can satisfy both
is_right()andis_bottom()conditions from the same parent node, causing it to appear in both branch collections.