From 5a361fd6b3b95e1688eeda0d18e0774e0106ad5d Mon Sep 17 00:00:00 2001 From: Jonathan Hamilton Date: Wed, 23 Aug 2017 08:36:33 -0700 Subject: [PATCH] Make the Android settings parser a bit more robust It would fail on lines line "Value =" - IE a value set to emptystring. This would cause the app to crash when trying to open the corresponding settings window. --- .../dolphinemu/dolphinemu/utils/SettingsFile.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/SettingsFile.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/SettingsFile.java index 205fffce6c..96f40c3296 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/SettingsFile.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/SettingsFile.java @@ -274,10 +274,13 @@ public final class SettingsFile 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); + } } } } @@ -381,6 +384,12 @@ public final class SettingsFile { 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();