From 9d0a88fae30fa13cc8b65b4a0ef5e232a3edba4c Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 11 Dec 2015 21:49:06 -0700 Subject: [PATCH] Safer check for popularity JSON data --- classes/popularity.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/popularity.php b/classes/popularity.php index aa16eda9..71555a0f 100644 --- a/classes/popularity.php +++ b/classes/popularity.php @@ -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 []; + } }