Skip to content

Commit 8efdc91

Browse files
authored
Merge pull request #4 from choleraehyq/fixpanic
fix panic when SelectorExpr has a package name parent
2 parents 770ce31 + 1fcc353 commit 8efdc91

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

exportloopref.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ func getIdentity(expr ast.Expr) *ast.Ident {
253253
if !ok {
254254
return nil
255255
}
256+
// parent is a package name identity
257+
if parent.Obj == nil {
258+
return nil
259+
}
256260
// NOTE: If that is descendants member like `a.b.c`,
257261
// typed.X will be `*ast.SelectorExpr`.
258262
return parent

0 commit comments

Comments
 (0)