diff options
author | Simon Schubert <2@0x2c.org> | 2015-06-25 11:12:59 +0200 |
---|---|---|
committer | Simon Schubert <2@0x2c.org> | 2015-06-25 11:54:11 +0200 |
commit | e3d0f8fbe51c95c26e03ecdbdcd2e3a869117fd4 (patch) | |
tree | 416f7265be7e33e8f73fababfc866b614373c520 /core | |
parent | 5e8c75a1da7375cd5a48902e6bd0bc5d175d0001 (diff) | |
download | AntennaPod-e3d0f8fbe51c95c26e03ecdbdcd2e3a869117fd4.zip |
gpoddernet: do not crash on unknown remote actions
According to [1] and my own episode actions feed, "action":"flattr" is a
valid action. Future-proof the episode actions code by ignoring actions
that we don't know and care about.
This fixes the
java.lang.IllegalArgumentException: FLATTR is not a constant
exception when fetching the episode actions list.
[1]: https://gpoddernet.readthedocs.org/en/latest/api/reference/events.html
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java index bd6210d13..efe39485e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java @@ -93,7 +93,12 @@ public class GpodnetEpisodeAction { if(StringUtils.isEmpty(podcast) || StringUtils.isEmpty(episode) || StringUtils.isEmpty(actionString)) { return null; } - GpodnetEpisodeAction.Action action = GpodnetEpisodeAction.Action.valueOf(actionString.toUpperCase()); + GpodnetEpisodeAction.Action action; + try { + action = GpodnetEpisodeAction.Action.valueOf(actionString.toUpperCase()); + } catch (IllegalArgumentException e) { + return null; + } String deviceId = object.optString("device", ""); GpodnetEpisodeAction.Builder builder = new GpodnetEpisodeAction.Builder(podcast, episode, action) .deviceId(deviceId); |