From 7c1b8aa771d6bd1799a538f078901d8f033c3134 Mon Sep 17 00:00:00 2001 From: Jonathan Cremin Date: Tue, 27 Jan 2015 21:23:05 +0000 Subject: [PATCH] Fix first view of shares --- views/share.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/views/share.jsx b/views/share.jsx index b04e57e..07c0109 100644 --- a/views/share.jsx +++ b/views/share.jsx @@ -113,12 +113,14 @@ module.exports = React.createClass({ clearInterval(this.state.interval); } - this.setState({ - name: shares[0].name, - artist: shares[0].artist.name, - shares: shares, - shareUrl: "https://match.audio/" + this.props.shares[0].service + "/" + this.props.shares[0].type + "/" + this.props.shares[0].id - }); + if (shares.length) { + this.setState({ + name: shares[0].name, + artist: shares[0].artist.name, + shares: shares, + shareUrl: "https://match.audio/" + shares[0].service + "/" + shares[0].type + "/" + shares[0].id + }); + } }.bind(this)); }.bind(this)