Fix #75: A non existing image of an image icon throws an exception.

This commit is contained in:
David Molineus
2019-02-13 12:33:44 +01:00
parent 55e4ed0702
commit 3be5da9176
2 changed files with 5 additions and 12 deletions

View File

@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix ordering changes in layer control element aren't recognized ([#72](https://github.com/netzmacht/contao-leaflet-maps/issues/72)) - Fix ordering changes in layer control element aren't recognized ([#72](https://github.com/netzmacht/contao-leaflet-maps/issues/72))
- Fix markers with negative coordinates aren't displayed ([#74](https://github.com/netzmacht/contao-leaflet-maps/issues/74)) - Fix markers with negative coordinates aren't displayed ([#74](https://github.com/netzmacht/contao-leaflet-maps/issues/74))
- Fix image icon with non existing image throws exception ([#75])(https://github.com/netzmacht/contao-leaflet-maps/issues/75))
## [3.1.3] - 2019-01-10 ## [3.1.3] - 2019-01-10

View File

@@ -71,16 +71,10 @@ class ImageIconMapper extends AbstractIconMapper
Request $request = null, Request $request = null,
$elementId = null $elementId = null
) { ) {
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId); $arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
$repository = $this->repositoryManager->getRepository(FilesModel::class);
if ($model->iconImage) { $file = $repository->findByUuid($model->iconImage);
$repository = $this->repositoryManager->getRepository(FilesModel::class); $arguments[] = $file ? $file->path : '';
$file = $repository->findByUuid($model->iconImage);
if ($file) {
$arguments[] = $file->path;
}
}
return $arguments; return $arguments;
} }
@@ -117,8 +111,6 @@ class ImageIconMapper extends AbstractIconMapper
$file = $repository->findByUuid($model->iconImage); $file = $repository->findByUuid($model->iconImage);
if ($file) { if ($file) {
$definition->setIconUrl($file->path);
$file = new File($file->path); $file = new File($file->path);
$definition->setIconSize([$file->width, $file->height]); $definition->setIconSize([$file->width, $file->height]);