Skip to content

Commit b626158

Browse files
authored
fix: visitor panic when Obj is nil (#6)
1 parent 4155955 commit b626158

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

makezero/makezero.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ func (v *visitor) recordNonZeroLengthSlices(node ast.Node) {
157157
if !ok {
158158
return
159159
}
160+
if ident.Obj == nil {
161+
return
162+
}
160163
v.nonZeroLengthSliceDecls[ident.Obj.Decl] = struct{}{}
161164
}
162165

0 commit comments

Comments
 (0)