From 4438807b26d53d8e8ab96867166b0e39e9cd1a79 Mon Sep 17 00:00:00 2001 From: Roliga Date: Wed, 26 Dec 2018 20:35:05 +0100 Subject: [PATCH] [SoundcloudBridge] Fix for artists with few tracks (#970) Artists with less than 10 tracks would return blank articles. This fixes that. --- bridges/SoundcloudBridge.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bridges/SoundcloudBridge.php b/bridges/SoundcloudBridge.php index 3853883ba98..1cea46c7793 100644 --- a/bridges/SoundcloudBridge.php +++ b/bridges/SoundcloudBridge.php @@ -32,7 +32,8 @@ public function collectData(){ . self::CLIENT_ID )) or returnServerError('No results for this user'); - for($i = 0; $i < 10; $i++) { + $numTracks = min(count($tracks), 10); + for($i = 0; $i < $numTracks; $i++) { $item = array(); $item['author'] = $tracks[$i]->user->username; $item['title'] = $tracks[$i]->user->username . ' - ' . $tracks[$i]->title;