add a null check for parseEnabledMap context param

This commit is contained in:
caneleex 2022-02-17 17:23:36 +01:00
parent 94c8684929
commit 10e39801ab
1 changed files with 3 additions and 0 deletions

View File

@ -96,6 +96,9 @@ public class Whitelist {
}
private static Map<WhitelistType, Boolean> parseEnabledMap(Context context) {
if (context == null) {
return Collections.emptyMap();
}
Map<WhitelistType, Boolean> enabledMap = new EnumMap<>(WhitelistType.class);
for (WhitelistType whitelistType : WhitelistType.values()) {
enabledMap.put(whitelistType, SharedPrefUtils.getBoolean(context, whitelistType.getSharedPreferencesName(), whitelistType.getPreferenceEnabledName()));