From dd17e5b834adb490f4a35d239703944d0be86603 Mon Sep 17 00:00:00 2001 From: Eric Cochran Date: Sun, 15 Jan 2017 21:45:48 -0800 Subject: [PATCH] patch --- .../com/f2prateek/rx/preferences2/StringSetAdapter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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,