diff --git a/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java b/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java index 1c47b4c1..c390e3c0 100644 --- a/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java +++ b/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java @@ -184,21 +184,19 @@ private void addRendition(Set candidates, Rendition rendition * @return Cropping dimensions or empty list if not found */ private @NotNull List getDynamicMediaCropDimensions(MediaArgs mediaArgs) { - if (mediaArgs.getMediaFormatOptions() == null) { + MediaFormatOption[] mediaFormatOptions = mediaArgs.getMediaFormatOptions(); + if (mediaFormatOptions == null) { return Collections.emptyList(); } List result = new ArrayList<>(); - MediaFormatOption[] mediaFormatOptions = mediaArgs.getMediaFormatOptions(); - if (mediaFormatOptions != null) { - for (MediaFormatOption mediaFormatOption : mediaFormatOptions) { - MediaFormat mediaFormat = mediaFormatOption.getMediaFormat(); - if (mediaFormat != null && mediaFormat.hasRatio()) { - NamedDimension smartCropDef = SmartCrop.getDimensionForRatio(damContext.getImageProfile(), mediaFormat.getRatio()); - if (smartCropDef != null) { - CropDimension cropDimension = SmartCrop.getCropDimensionForAsset(damContext.getAsset(), damContext.getResourceResolver(), smartCropDef); - if (cropDimension != null) { - result.add(cropDimension); - } + for (MediaFormatOption mediaFormatOption : mediaFormatOptions) { + MediaFormat mediaFormat = mediaFormatOption.getMediaFormat(); + if (mediaFormat != null && mediaFormat.hasRatio()) { + NamedDimension smartCropDef = SmartCrop.getDimensionForRatio(damContext.getImageProfile(), mediaFormat.getRatio()); + if (smartCropDef != null) { + CropDimension cropDimension = SmartCrop.getCropDimensionForAsset(damContext.getAsset(), damContext.getResourceResolver(), smartCropDef); + if (cropDimension != null) { + result.add(cropDimension); } } }