Provide an empty asset manifest if the FLX does not contain any assets (#7243)

Without this, an FLX with no assets may be completely empty in AOT mode.
This will result in a warning when the engine's unzip library tries to
parse the FLX.

Fixes https://github.com/flutter/flutter/issues/7060
This commit is contained in:
Jason Simmons 2016-12-13 13:43:28 -08:00 committed by GitHub
parent 8782d95c6a
commit f2342a6141
2 changed files with 9 additions and 0 deletions

View File

@ -111,6 +111,7 @@ class AssetBundle {
} }
if (manifest == null) { if (manifest == null) {
// No manifest file found for this application. // No manifest file found for this application.
entries.add(new AssetBundleEntry.fromString('AssetManifest.json', '{}'));
return 0; return 0;
} }
if (manifest != null) { if (manifest != null) {

View File

@ -61,4 +61,12 @@ void main() {
expect(assetContents, UTF8.decode(entry.contentsAsBytes())); expect(assetContents, UTF8.decode(entry.contentsAsBytes()));
}); });
}); });
group('AssetBundle.build', () {
test('nonempty', () async {
AssetBundle ab = new AssetBundle();
expect(await ab.build(), 0);
expect(ab.entries.length, greaterThan(0));
});
});
} }