From 95d10d478d08a602f86b69ca13fef8b0e71b5b48 Mon Sep 17 00:00:00 2001 From: quentinchampenois <26109239+Quentinchampenois@users.noreply.github.com> Date: Fri, 24 May 2024 14:21:15 +0200 Subject: [PATCH] fix: Prevent crash when geojson values are nil --- lib/decidim/homepage_interactive_map/coordinates_swapper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/decidim/homepage_interactive_map/coordinates_swapper.rb b/lib/decidim/homepage_interactive_map/coordinates_swapper.rb index 06969bb..4c7d0d3 100644 --- a/lib/decidim/homepage_interactive_map/coordinates_swapper.rb +++ b/lib/decidim/homepage_interactive_map/coordinates_swapper.rb @@ -8,7 +8,8 @@ module HomepageInteractiveMap # This class swaps the coordinates of a feature module CoordinatesSwapper def self.convert_geojson(geojson, opts = {}) - return nil if geojson.nil? + return if geojson.nil? + return if geojson.try(:values)&.compact.blank? from = opts[:from] || detect_crs(geojson) || "EPSG:4326" to = opts[:to] || "EPSG:4326"