Skip to content

Commit

Permalink
fix: Prevent crash when geojson values are nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentinchampenois committed May 24, 2024
1 parent 9d01ce3 commit 95d10d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/decidim/homepage_interactive_map/coordinates_swapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 95d10d4

Please sign in to comment.