From 898a1ce5453247ac81c0ead3a67953a297be0e7e Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Thu, 2 Mar 2017 14:47:16 +0100 Subject: [PATCH] Let soudcloud fail gracefuly when unconfigured This makes general preferences look nice again, even when no soundcloud id and secret is configured (those don't belong us). --- airtime_mvc/application/services/SoundcloudService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/services/SoundcloudService.php b/airtime_mvc/application/services/SoundcloudService.php index 72c56dbde..b94e68968 100644 --- a/airtime_mvc/application/services/SoundcloudService.php +++ b/airtime_mvc/application/services/SoundcloudService.php @@ -64,8 +64,10 @@ class Application_Service_SoundcloudService extends Application_Service_ThirdPar $clientSecret = $CC_CONFIG['soundcloud-client-secret']; $redirectUri = $CC_CONFIG['soundcloud-redirect-uri']; - $this->_client = new Soundcloud\Service($clientId, $clientSecret, $redirectUri); - $accessToken = Application_Model_Preference::getSoundCloudRequestToken(); + if ($clientId && $clientSecret && $redirectUri) { + $this->_client = new Soundcloud\Service($clientId, $clientSecret, $redirectUri); + $accessToken = Application_Model_Preference::getSoundCloudRequestToken(); + } if (!empty($accessToken)) { $this->_accessToken = $accessToken; $this->_client->setAccessToken($accessToken);