Skip to content

Conversation

@tdragon
Copy link

@tdragon tdragon commented Nov 3, 2025

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:

  1. A pane is processed through one branch (e.g., right branch)
  2. After processing, root.pane is set to nil (line 122) to avoid memory leaks
  3. The same pane node is encountered again through another branch (e.g., bottom branch)
  4. Attempting to call root.pane:get_domain_name() on the already-nil pane causes the crash

This happens because in symmetric layouts, a pane can satisfy both is_right() and is_bottom() conditions from the same parent node, causing it to appear in both branch collections.

Add guard clause to skip panes that have already been processed by
another branch in symmetric layouts (e.g., perfect cross layout).
This prevents nil pane access errors when a pane appears in both
right and bottom branches.

Fixes MLFlexer#98
@tdragon tdragon force-pushed the fix/duplicate-pane-processing branch from 6679791 to ec66651 Compare November 3, 2025 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

possible json sanitize bug on workspace switching

1 participant