prevent bug for empty data

This commit is contained in:
Steffen Schröder 2014-05-22 16:21:32 +02:00
parent 255912b335
commit 7830a017ad

View File

@ -248,9 +248,9 @@ class ManiaExchangeManager {
trigger_error($error); trigger_error($error);
} else { } else {
$mxMapList = json_decode($mapInfo); $mxMapList = json_decode($mapInfo);
if ($mxMapList === null) { if (!is_array($mxMapList)) {
trigger_error('Cannot decode searched JSON data from ' . $url); trigger_error('Cannot decode searched JSON data from ' . $url);
} else { } else if (count($mxMapList) > 0) {
$mxMapInfo = new MXMapInfo($titlePrefix, $mxMapList[0]); $mxMapInfo = new MXMapInfo($titlePrefix, $mxMapList[0]);
} }
} }