From 9a961c8dd2a0282865bc6383f57956a0a87fca9e Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 5 Nov 2025 13:55:22 +0100 Subject: [PATCH] fix: check if tree-sitter Node.getParent() returns a null node in expand_selection closes #360 --- src/tui/editor.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 20ebee1..7e1abc2 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -4363,6 +4363,8 @@ pub const Editor = struct { while (parent_sel.eql(node_sel)) { node = parent; parent = parent.getParent(); + if (parent.tree == null) + return node; parent_sel = CurSel.selection_from_node(parent, root, metrics) catch return node; } return node;