Fixed error when new list is empty

This commit is contained in:
Nixo
2014-10-23 01:13:11 +02:00
parent cde3259276
commit 7e3725b34e

View File

@@ -6,9 +6,11 @@
$data = json_decode(file_get_contents($list), true);
$songs = $data["nowPlaying"];
$id = array_values($songs);
if(count($id)>0){
$diff = (time() - $data["conf"]["startTime"]);
$returnArray = array($diff, $id[0]["id"], time(), $data["conf"]["startTime"], $id[0]["title"], $data["conf"]["views"]);
$returnArray = json_encode($returnArray);
echo $returnArray;
}
echo("[0,0,0,0,0,0]");
?>