From 48a6a3a360f79fd7a2c94600ee83311c96ac7a21 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Thu, 6 Oct 2016 11:38:52 +0200 Subject: [PATCH] Check options before assigning them. --- src/Netzmacht/Contao/Leaflet/Mapper/MapMapper.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/MapMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/MapMapper.php index 1741e40..e4d1bcb 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/MapMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/MapMapper.php @@ -14,6 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Mapper; use Netzmacht\Contao\Leaflet\Filter\Filter; use Netzmacht\Contao\Leaflet\Model\ControlModel; use Netzmacht\Contao\Leaflet\Model\MapModel; +use Netzmacht\JavascriptBuilder\Type\Expression; use Netzmacht\LeafletPHP\Definition; use Netzmacht\LeafletPHP\Definition\Control; use Netzmacht\LeafletPHP\Definition\Layer; @@ -98,7 +99,11 @@ class MapMapper extends AbstractMapper protected function buildCustomOptions(Map $map, MapModel $model) { if ($model->options) { - $map->setOptions(json_decode($model->options, true)); + $options = json_decode($model->options, true); + + if (is_array($options)) { + $map->setOptions($options); + } } $map->setOption('dynamicLoad', (bool) $model->dynamicLoad);