From ae3d8cac5e4b1f25d6f108e40bf61535e32e7866 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 4 Feb 2020 12:03:23 +0100 Subject: [PATCH] Avoiding panics for empty tree views. --- treeview.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/treeview.go b/treeview.go index 80a4df1..2d95763 100644 --- a/treeview.go +++ b/treeview.go @@ -409,6 +409,9 @@ func (t *TreeView) process() { // Determine visible nodes and their placement. var graphicsOffset, maxTextX int t.nodes = nil + if t.root == nil { + return + } selectedIndex := -1 topLevelGraphicsX := -1 if t.graphics {