Skip to content

Commit 6dfcad6

Browse files
committed
Fixed error in Spotify plugin
1 parent 306cc50 commit 6dfcad6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Plugin/Spotify.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function onPublicText( Update $update )
5959

6060
// perform search
6161
$result = $this->doSearch($query);
62-
if (!isset( $result['tracks']['items']) )
62+
if (!isset( $result['tracks']['items']) || !count($result['tracks']['items']) )
6363
{
6464
$update->answerMessage("Nothing found :( Let's try again?");
6565
return false;
@@ -137,6 +137,9 @@ private function doSearch( $query )
137137

138138
private function getTrackInformation($element )
139139
{
140+
141+
if (!$element) return false;
142+
140143
// get names of artists and join them together
141144
$artists = implode( ' & ', array_map(function ($artist){
142145
return $artist['name'];

0 commit comments

Comments
 (0)