Merge pull request #839 from jgmdev/nil-nodes-fix

Fix cases of nil node.
This commit is contained in:
Adam 2022-02-11 11:52:43 -05:00 committed by GitHub
commit b05a02cb28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -30,7 +30,9 @@ end
function RootView:get_active_node()
return self.root_node:get_node_for_view(core.active_view)
local node = self.root_node:get_node_for_view(core.active_view)
if not node then node = self:get_primary_node() end
return node
end
@ -46,6 +48,7 @@ end
function RootView:get_active_node_default()
local node = self.root_node:get_node_for_view(core.active_view)
if not node then node = self:get_primary_node() end
if node.locked then
local default_view = self:get_primary_node().views[1]
assert(default_view, "internal error: cannot find original document node.")