Commit f2342a61 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

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
parent 8782d95c
...@@ -111,6 +111,7 @@ class AssetBundle { ...@@ -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) {
......
...@@ -61,4 +61,12 @@ void main() { ...@@ -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));
});
});
} }
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