Prevent 500 errors when no content is available
This commit is contained in:
parent
49065b16de
commit
b15166ecbe
|
@ -298,19 +298,19 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$stationUrl = Application_Common_HTTPHelper::getStationUrl();
|
$stationUrl = Application_Common_HTTPHelper::getStationUrl();
|
||||||
|
|
||||||
if ($result["previous"]["type"] != "livestream") {
|
if (($result["previous"]["type"] != "livestream") && isset($result["previous"]["metadata"])) {
|
||||||
$previousID = $result["previous"]["metadata"]["id"];
|
$previousID = $result["previous"]["metadata"]["id"];
|
||||||
$get_prev_artwork_url = $stationUrl . 'api/track?id='. $previousID .'&return=artwork';
|
$get_prev_artwork_url = $stationUrl . 'api/track?id='. $previousID .'&return=artwork';
|
||||||
$result["previous"]["metadata"]["artwork_url"] = $get_prev_artwork_url;
|
$result["previous"]["metadata"]["artwork_url"] = $get_prev_artwork_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result["current"]["type"] != "livestream") {
|
if (($result["current"]["type"] != "livestream") && isset($result["current"]["metadata"])) {
|
||||||
$currID = $result["current"]["metadata"]["id"];
|
$currID = $result["current"]["metadata"]["id"];
|
||||||
$get_curr_artwork_url = $stationUrl . 'api/track?id='. $currID .'&return=artwork';
|
$get_curr_artwork_url = $stationUrl . 'api/track?id='. $currID .'&return=artwork';
|
||||||
$result["current"]["metadata"]["artwork_url"] = $get_curr_artwork_url;
|
$result["current"]["metadata"]["artwork_url"] = $get_curr_artwork_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result["next"]["type"] != "livestream") {
|
if (($result["next"]["type"] != "livestream") && isset($result["next"]["metadata"])) {
|
||||||
$nextID = $result["next"]["metadata"]["id"];
|
$nextID = $result["next"]["metadata"]["id"];
|
||||||
$get_next_artwork_url = $stationUrl . 'api/track?id='. $nextID .'&return=artwork';
|
$get_next_artwork_url = $stationUrl . 'api/track?id='. $nextID .'&return=artwork';
|
||||||
$result["next"]["metadata"]["artwork_url"] = $get_next_artwork_url;
|
$result["next"]["metadata"]["artwork_url"] = $get_next_artwork_url;
|
||||||
|
@ -1711,4 +1711,4 @@ class ApiController extends Zend_Controller_Action
|
||||||
// enable cors access from configured URLs
|
// enable cors access from configured URLs
|
||||||
CORSHelper::enableCrossOriginRequests($request, $response);
|
CORSHelper::enableCrossOriginRequests($request, $response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue