Skip to content

Commit 1fcc353

Browse files
committed
fix panic when SelectorExpr has a package name parent
Signed-off-by: Cholerae Hu <choleraehyq@gmail.com>
1 parent 619c505 commit 1fcc353

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)