Skip to content

Commit

Permalink
Graceful treatment for null values for repeat and random.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickse committed May 19, 2017
1 parent a0068ee commit 9b2ac4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ The devices support the following channels:
Audio Support is still experimental in this binding.

## Full Example

```
```
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ public void update(JSONObject jsonObject) throws JSONException {
setCoverArt(null);
}

if (jsonObject.has(CHANNEL_PLAY_RANDOM)) {
if (jsonObject.has(CHANNEL_PLAY_RANDOM) && !jsonObject.isNull(CHANNEL_PLAY_RANDOM)) {
setRandom(jsonObject.getBoolean(CHANNEL_PLAY_RANDOM));
} else {
setRandom(false);
}

if (jsonObject.has(CHANNEL_PLAY_REPEAT)) {
if (jsonObject.has(CHANNEL_PLAY_REPEAT) && !jsonObject.isNull(CHANNEL_PLAY_REPEAT)) {
setRepeat(jsonObject.getBoolean(CHANNEL_PLAY_REPEAT));
} else {
setRepeat(false);
Expand Down

0 comments on commit 9b2ac4a

Please sign in to comment.