mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
[flutter_tools] handle missing null check in manifest parser (#57400)
This commit is contained in:
parent
70b889a9a3
commit
91ec439348
|
@ -565,7 +565,9 @@ class ApkManifestData {
|
|||
}
|
||||
|
||||
final _Element application = manifest.firstElement('application');
|
||||
assert(application != null);
|
||||
if (application == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final Iterable<_Element> activities = application.allElements('activity');
|
||||
|
||||
|
|
|
@ -206,6 +206,12 @@ void main() {
|
|||
expect(data.packageName, 'io.flutter.examples.hello_world');
|
||||
expect(data.launchableActivityName, 'io.flutter.examples.hello_world.MainActivity');
|
||||
}, overrides: noColorTerminalOverride);
|
||||
|
||||
testUsingContext('Parses manifest with missing application tag', () async {
|
||||
final ApkManifestData data = ApkManifestData.parseFromXmlDump(_aaptDataWithoutApplication);
|
||||
|
||||
expect(data, isNull);
|
||||
});
|
||||
});
|
||||
|
||||
group('PrebuiltIOSApp', () {
|
||||
|
@ -644,6 +650,26 @@ N: android=http://schemas.android.com/apk/res/android
|
|||
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
|
||||
''';
|
||||
|
||||
const String _aaptDataWithoutApplication = '''
|
||||
N: android=http://schemas.android.com/apk/res/android
|
||||
N: dist=http://schemas.android.com/apk/distribution
|
||||
E: manifest (line=7)
|
||||
A: android:versionCode(0x0101021b)=(type 0x10)0x1
|
||||
A: android:versionName(0x0101021c)="1.0" (Raw: "1.0")
|
||||
A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1c
|
||||
A: android:compileSdkVersionCodename(0x01010573)="9" (Raw: "9")
|
||||
A: package="io.flutter.examples.hello_world" (Raw: "io.flutter.examples.hello_world")
|
||||
A: platformBuildVersionCode=(type 0x10)0x1
|
||||
A: platformBuildVersionName=(type 0x4)0x3f800000
|
||||
E: uses-sdk (line=13)
|
||||
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
|
||||
A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
|
||||
E: dist:module (line=17)
|
||||
A: dist:instant=(type 0x12)0xffffffff
|
||||
E: uses-permission (line=24)
|
||||
A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
|
||||
''';
|
||||
|
||||
|
||||
class MockPlistUtils extends Mock implements PlistParser {
|
||||
@override
|
||||
|
|
Loading…
Reference in a new issue