Adding missing break in plugin validation check (#43180)

This commit is contained in:
Jonah Williams
2019-10-21 16:46:07 -07:00
committed by GitHub
parent 8df0d6556d
commit 6c91a13731
2 changed files with 14 additions and 1 deletions

View File

@@ -401,8 +401,9 @@ void _validateFlutter(YamlMap yaml, List<String> errors) {
}
break;
case 'plugin':
if (kvp.value is! YamlMap) {
if (kvp.value is! YamlMap || kvp.value == null) {
errors.add('Expected "${kvp.key}" to be an object, but got ${kvp.value} (${kvp.value.runtimeType}).');
break;
}
final List<String> pluginErrors = Plugin.validatePluginYaml(kvp.value);
errors.addAll(pluginErrors);

View File

@@ -400,6 +400,18 @@ flutter:
expect(flutterManifest.androidPackage, 'com.example');
});
testUsingContext('handles an invalid plugin declaration', () async {
final BufferLogger bufferLogger = context.get<Logger>();
const String manifest = '''
name: test
flutter:
plugin:
''';
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
expect(flutterManifest, null);
expect(bufferLogger.errorText, contains('Expected "plugin" to be an object, but got null'));
});
Future<void> checkManifestVersion({
String manifest,