Skip to content

Commit c4a16f0

Browse files
Ignore missing cookie node for checkbox tree when adding new checkbox
1 parent 54b29fa commit c4a16f0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lua/orgmode/treesitter/listitem.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ function Listitem:cookie()
8888
local content = self.listitem:field('contents')[1]
8989
-- The cookie should be the last thing on the line
9090
local cookie_node = content:named_child(content:named_child_count() - 1)
91+
if not cookie_node then
92+
return nil
93+
end
9194

9295
local text = query.get_node_text(cookie_node, 0)
9396
if text:match('%[%d*/%d*%]') or text:match('%[%d?%d?%d?%%%]') then

0 commit comments

Comments
 (0)