Skip to content

Commit 334a131

Browse files
keertipCommit Queue
authored and
Commit Queue
committed
[dart fix] Catch exception when parsing pubspecs.
Fixes #56473. Change-Id: I4b69a74c4d0f129ff25a074104b80c6b75e96e9b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380076 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Keerti Parthasarathy <[email protected]>
1 parent cce42a3 commit 334a131

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,10 +922,17 @@ class BulkFixProcessor {
922922
Set<String> usedDevDeps,
923923
ResourceProvider resourceProvider) async {
924924
String contents = pubspec.contents.data;
925-
YamlNode node = loadYamlNode(contents);
925+
YamlNode? node;
926+
try {
927+
node = loadYamlNode(contents);
928+
} catch (_) {
929+
// Could not parse the pubspec file.
930+
return [];
931+
}
932+
926933
if (node is! YamlMap) {
927934
// The file is empty.
928-
node = YamlMap();
935+
return [];
929936
}
930937

931938
var errors = MissingDependencyValidator(node, pubspec, resourceProvider)

0 commit comments

Comments
 (0)