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 }