Unverified Commit 29775f74 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

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.
parent 7f087670
...@@ -656,12 +656,10 @@ class PubspecYaml { ...@@ -656,12 +656,10 @@ class PubspecYaml {
} }
} }
// By this point we should know where to put our transitive dependencies. // If there are no dependencies or dev_dependencies sections, these will be
// Only if there were no dependencies or dev_dependencies sections could // null. We have such files in our tests, so account for them here.
// we get here with these still null, and we should not have any such files endOfDirectDependencies ??= output.length;
// in our repo. endOfDevDependencies ??= output.length;
assert(endOfDirectDependencies != null);
assert(endOfDevDependencies != null);
// Now include all the transitive dependencies and transitive dev dependencies. // Now include all the transitive dependencies and transitive dev dependencies.
// The blocks of text to insert for each dependency section. // The blocks of text to insert for each dependency section.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment