mirror of
https://github.com/apple/pkl.git
synced 2026-03-21 08:39:09 +01:00
Fix crash due to parse error in module header (#1112)
This commit is contained in:
@@ -33,7 +33,8 @@ public final class Module extends AbstractNode {
|
||||
|
||||
public @Nullable ModuleDecl getDecl() {
|
||||
assert children != null;
|
||||
return (ModuleDecl) children.get(0);
|
||||
// children can be empty when there was a parse error
|
||||
return children.isEmpty() ? null : (ModuleDecl) children.get(0);
|
||||
}
|
||||
|
||||
public List<ImportClause> getImports() {
|
||||
|
||||
@@ -91,6 +91,7 @@ class ParserComparisonTest : ParserComparisonTestInterface {
|
||||
"errors/underscore.pkl",
|
||||
"notAUnionDefault.pkl",
|
||||
"multipleDefaults.pkl",
|
||||
"modules/invalidModule1.pkl",
|
||||
)
|
||||
|
||||
private val regexExceptions =
|
||||
|
||||
Reference in New Issue
Block a user