Skip to content

Commit

Permalink
Merge pull request #5967 from JonnyH/WIP/more-robust-android-settings…
Browse files Browse the repository at this point in the history
…-parser

Make the Android settings parser a bit more robust
  • Loading branch information
JosJuice committed Aug 26, 2017
2 parents a861c57 + 5a361fd commit 072b423
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,13 @@ public static HashMap<String, SettingSection> readFile(final String fileName, Se
current = sectionFromLine(line);
sections.put(current.getName(), current);
}
else if ((current != null) && line.contains("="))
else if ((current != null))
{
Setting setting = settingFromLine(current, line, fileName);
current.putSetting(setting);
if (setting != null)
{
current.putSetting(setting);
}
}
}
}
Expand Down Expand Up @@ -381,6 +384,12 @@ private static Setting settingFromLine(SettingSection current, String line, Stri
{
String[] splitLine = line.split("=");

if (splitLine.length != 2)
{
Log.warning("Skipping invalid config line \"" + line + "\"");
return null;
}

String key = splitLine[0].trim();
String value = splitLine[1].trim();

Expand Down

0 comments on commit 072b423

Please sign in to comment.