From 61106183f59255dfe3ab8fa4516508fa5537efc7 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker Date: Thu, 23 Oct 2025 17:32:39 -0700 Subject: [PATCH] check for nil --- internal/compiler/fileloader.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/compiler/fileloader.go b/internal/compiler/fileloader.go index f26dcacb10..8eb16c3f6a 100644 --- a/internal/compiler/fileloader.go +++ b/internal/compiler/fileloader.go @@ -790,12 +790,16 @@ func getModuleLiteralImportKind(node *ast.StringLiteralLike) *string { } if ast.IsImportDeclaration(parent) || ast.IsExportDeclaration(parent) { - var elements []*ast.Node + var attrs *ast.ImportAttributesNode if ast.IsImportDeclaration(parent) { - elements = parent.AsImportDeclaration().Attributes.AsImportAttributes().Attributes.Nodes + attrs = parent.AsImportDeclaration().Attributes } else { - elements = parent.AsExportDeclaration().Attributes.AsImportAttributes().Attributes.Nodes + attrs = parent.AsExportDeclaration().Attributes } + if attrs == nil { + return nil + } + elements := attrs.AsImportAttributes().Attributes.Nodes if elements == nil { return nil }