diff --git a/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/StringSetAdapter.java b/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/StringSetAdapter.java index ae0270c..62827f4 100644 --- a/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/StringSetAdapter.java +++ b/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/StringSetAdapter.java @@ -13,7 +13,11 @@ final class StringSetAdapter implements Preference.Adapter> { static final StringSetAdapter INSTANCE = new StringSetAdapter(); @Override public Set get(@NonNull String key, @NonNull SharedPreferences preferences) { - return Collections.unmodifiableSet(preferences.getStringSet(key, null)); + Set set = preferences.getStringSet(key, null); + if (set == null) { + return null; + } + return Collections.unmodifiableSet(set); } @Override public void set(@NonNull String key, @NonNull Set value,