From 1be7a32c6bfc6b215b1575f15f02356e2b694e7a Mon Sep 17 00:00:00 2001 From: rxi Date: Sun, 12 Apr 2020 11:14:49 +0100 Subject: [PATCH] Fixed error on setting active view when closing certain splits in RootView --- data/core/rootview.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index 36dded74..0a58a6e4 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -104,13 +104,18 @@ function Node:close_active_view(root) self:set_active_view(self.views[idx] or self.views[#self.views]) else local parent = self:get_parent_node(root) - local other = parent[parent.a == self and "b" or "a"] + local is_a = (parent.a == self) + local other = parent[is_a and "b" or "a"] if other:get_locked_size() then self.views = {} self:add_view(EmptyView()) else parent:consume(other) - parent:set_active_view(parent.active_view) + local p = parent + while p.type ~= "leaf" do + p = p[is_a and "a" or "b"] + end + p:set_active_view(p.active_view) end end end @@ -129,6 +134,7 @@ end function Node:set_active_view(view) + assert(self.type == "leaf", "tried to set active view on non-leaf node") self.active_view = view core.active_view = view end