From bd21a4af07a35bbb8d9fa151ce982da2c3d28124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Fri, 8 Nov 2019 19:29:02 +0100 Subject: [PATCH] Fix wrong test in getCrityInformation --- lib/Controller/CityController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Controller/CityController.php b/lib/Controller/CityController.php index 463f9a7..61563de 100644 --- a/lib/Controller/CityController.php +++ b/lib/Controller/CityController.php @@ -135,6 +135,11 @@ class CityController extends IntermediateController { "http://api.openweathermap.org/data/2.5/forecast?q=".urlencode($name)."&mode=json&APPID=".urlencode($apiKey))[1], true); + // If no cod we just return a 502 as the API is not responding properly + if (!in_array('cod', $cityDatas)) { + return array("code" => 502, "response" => null); + } + if ($cityDatas['cod'] != '200') { return array("code" => $cityDatas['cod'], "response" => null, "apikey" => $apiKey); }