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 {
.split('\n')
.map<String>((String line) => line.trim())
.where((String line) => line.isNotEmpty);
final Map<String, String> properties = Map<String, String>.fromIterable(
propertiesFileLines.map<List<String>>((String line) => line.split(' = ')),
key: (dynamic split) => split[0],
value: (dynamic split) => split[1]);
final Map<String, String> properties = <String, String>{};
for (String line in propertiesFileLines) {
final List<String> parts = line.split(' = ');
if (parts.length == 2) {
properties[parts[0]] = parts[1];
} else {
printError('Malformed line in ndk source.properties: "$line".');
}
}
if (!properties.containsKey('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