From a9fc1dacaabfbca89d3a7bed5c49a7f264850d94 Mon Sep 17 00:00:00 2001 From: cmp Date: Tue, 24 Jan 2023 09:47:28 -0600 Subject: Fix wikimode occasionally being null from the API (#1315) --- .../infinityforreddit/subreddit/SubredditSettingData.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/src') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSettingData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSettingData.java index 4759d102..d718ef08 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSettingData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSettingData.java @@ -6,6 +6,10 @@ import com.google.gson.annotations.SerializedName; import java.util.Objects; public class SubredditSettingData { + public static final String WIKIMODE_ANYONE = "anyone"; + public static final String WIKIMODE_DISABLED = "disabled"; + public static final String WIKIMODE_MODONLY = "modonly"; + // Content visibility || Posts to this profile can appear in r/all and your profile can be discovered in /users @SerializedName("default_set") private boolean defaultSet; @@ -246,6 +250,10 @@ public class SubredditSettingData { } public String getWikiMode() { + if (wikiMode == null) { + // Default to disabled, since occasionally the API returns null. + return WIKIMODE_DISABLED; + } return wikiMode; } -- cgit v1.2.3