Skip to content

Commit

Permalink
Handle invalid data from backend gracefully (no more blank
Browse files Browse the repository at this point in the history
screen/loader), fixes #60
  • Loading branch information
nukeop committed Aug 5, 2018
1 parent 3e065d9 commit 2ccc96e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/components/AlbumView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ class AlbumView extends React.Component {
album
} = this.props;

if(_.some(_.map([album.images, album.artists, album.styles], _.isEmpty))) {
return (
<div>
<h3>Discogs returned invalid data.</h3>
<h4>Try going back to search.</h4>
</div>
);
}

let albumImage = _.find(album.images, {'type': 'primary'});
if(!albumImage) {
albumImage = album.images ? album.images[0].uri : artPlaceholder;
Expand Down

0 comments on commit 2ccc96e

Please sign in to comment.