From df996c3ae1946ea42e3abf84a06a6dfe8c5bcdcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=B6hmke?= Date: Wed, 26 Feb 2020 21:43:19 +0100 Subject: [PATCH] xgotext: catch unknown variable type --- cli/xgotext/parser/golang.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/xgotext/parser/golang.go b/cli/xgotext/parser/golang.go index bb63c72..2693503 100644 --- a/cli/xgotext/parser/golang.go +++ b/cli/xgotext/parser/golang.go @@ -193,7 +193,8 @@ func (g *GoFile) inspectCallExpr(n *ast.CallExpr) { } else { // validate type of object - if !g.checkType(g.getType(e).Type()) { + t := g.getType(e) + if t == nil || !g.checkType(t.Type()) { return } } @@ -201,7 +202,8 @@ func (g *GoFile) inspectCallExpr(n *ast.CallExpr) { // call to attribute case *ast.SelectorExpr: // validate type of object - if !g.checkType(g.getType(e.Sel).Type()) { + t := g.getType(e.Sel) + if t == nil || !g.checkType(t.Type()) { return }