Merge pull request #2557 from ocrow/develop

Fix for #2555 - handle null SSID in WiFi list
This commit is contained in:
Martin Fietz 2018-02-04 22:05:17 -08:00 committed by GitHub
commit c13acc624d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -764,6 +764,10 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
} }
} }
private static String blankIfNull(String val) {
return val == null ? "" : val;
}
private void buildAutodownloadSelectedNetworsPreference() { private void buildAutodownloadSelectedNetworsPreference() {
final Activity activity = ui.getActivity(); final Activity activity = ui.getActivity();
@ -778,7 +782,8 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc
Log.e(TAG, "Couldn't get list of configure Wi-Fi networks"); Log.e(TAG, "Couldn't get list of configure Wi-Fi networks");
return; return;
} }
Collections.sort(networks, (x, y) -> x.SSID.compareTo(y.SSID)); Collections.sort(networks, (x, y) ->
blankIfNull(x.SSID).compareTo(blankIfNull(y.SSID)));
selectedNetworks = new CheckBoxPreference[networks.size()]; selectedNetworks = new CheckBoxPreference[networks.size()];
List<String> prefValues = Arrays.asList(UserPreferences List<String> prefValues = Arrays.asList(UserPreferences
.getAutodownloadSelectedNetworks()); .getAutodownloadSelectedNetworks());