Safer check for popularity JSON data

This commit is contained in:
Andy Miller
2015-12-11 21:49:06 -07:00
parent 0b17baacbe
commit 9d0a88fae3

View File

@@ -248,7 +248,11 @@ class Popularity
protected function getData($path)
{
return (array) @json_decode(file_get_contents($path), true);
if (file_exists($path)) {
return (array) json_decode(file_get_contents($path), true);
} else {
return [];
}
}