mirror of
https://github.com/flutter/flutter
synced 2024-09-21 09:11:56 +00:00
Handle pubspec.yaml files with no dependencies (#17195)
Currently, `flutter update-packages --force-upgrade` will crash if it encounters a pubspec.yaml file with no dependencies (either regular or dev). The assumption that we'd never see such pubspec files is no longer valid, as we have such a file in one of our tests.
This commit is contained in:
parent
7f0876700a
commit
29775f74fb
|
@ -656,12 +656,10 @@ class PubspecYaml {
|
|||
}
|
||||
}
|
||||
|
||||
// By this point we should know where to put our transitive dependencies.
|
||||
// Only if there were no dependencies or dev_dependencies sections could
|
||||
// we get here with these still null, and we should not have any such files
|
||||
// in our repo.
|
||||
assert(endOfDirectDependencies != null);
|
||||
assert(endOfDevDependencies != null);
|
||||
// If there are no dependencies or dev_dependencies sections, these will be
|
||||
// null. We have such files in our tests, so account for them here.
|
||||
endOfDirectDependencies ??= output.length;
|
||||
endOfDevDependencies ??= output.length;
|
||||
|
||||
// Now include all the transitive dependencies and transitive dev dependencies.
|
||||
// The blocks of text to insert for each dependency section.
|
||||
|
|
Loading…
Reference in a new issue