Unverified Commit 75c50da5 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Ensure that different formatting of ndk properties file does not crash tool (#29528)

parent bd697d4b
...@@ -216,10 +216,15 @@ class AndroidNdk { ...@@ -216,10 +216,15 @@ class AndroidNdk {
.split('\n') .split('\n')
.map<String>((String line) => line.trim()) .map<String>((String line) => line.trim())
.where((String line) => line.isNotEmpty); .where((String line) => line.isNotEmpty);
final Map<String, String> properties = Map<String, String>.fromIterable( final Map<String, String> properties = <String, String>{};
propertiesFileLines.map<List<String>>((String line) => line.split(' = ')), for (String line in propertiesFileLines) {
key: (dynamic split) => split[0], final List<String> parts = line.split(' = ');
value: (dynamic split) => split[1]); if (parts.length == 2) {
properties[parts[0]] = parts[1];
} else {
printError('Malformed line in ndk source.properties: "$line".');
}
}
if (!properties.containsKey('Pkg.Revision')) { if (!properties.containsKey('Pkg.Revision')) {
throw AndroidNdkSearchError('Can not establish ndk-bundle version: $propertiesFile does not contain Pkg.Revision'); throw AndroidNdkSearchError('Can not establish ndk-bundle version: $propertiesFile does not contain Pkg.Revision');
......
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