From 669f19fe9b60d3823ae668d532ee1131982b435b Mon Sep 17 00:00:00 2001 From: skanehira Date: Sat, 23 Nov 2019 14:04:04 +0900 Subject: [PATCH] fix nil pointer when parsing incorrect JSON --- gui/gui.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gui/gui.go b/gui/gui.go index f674049..e40c4c2 100644 --- a/gui/gui.go +++ b/gui/gui.go @@ -247,6 +247,9 @@ func (g *Gui) MakeJSON(node *tview.TreeNode) interface{} { } return i case Key: + if len(node.GetChildren()) == 0 { + return "" + } v := node.GetChildren()[0] if v.GetReference().(Reference).JSONType == Value { return g.parseValue(v)