Skip to content

Commit be4becd

Browse files
author
Chris Pecunies
committed
handling nonexistent ts nodes
1 parent 210368a commit be4becd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lua/down/mod/link/init.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,25 @@ end
112112

113113
Link.cursor = function()
114114
local node = tsu.get_node_at_cursor()
115+
if not node then return end
115116
return node, node:type()
116117
end
117118

118119
Link.parent = function(node)
119120
local parent = node:parent()
121+
if not parent then return end
120122
return parent, parent:type()
121123
end
122124

123125
Link.node = {
124126
prev = function(node)
125127
local next = tsu.get_prev_node(node)
128+
if not next then return end
126129
return next, next:type()
127130
end,
128131
next = function(node)
129132
local next = tsu.get_next_node(node)
133+
if not next then return end
130134
return next, next:type()
131135
end
132136
}

lua/down/mod/task/agenda/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Agenda.Agenda = {
1414
tasks = {},
1515
}
1616

17-
---@class table<down.mod..task.agenda.Agenda>
17+
---@class table<down.mod.task.agenda.Agenda>
1818
Agenda.agendas = {}
1919

2020
---@class down.mod..task.agenda.Config

0 commit comments

Comments
 (0)