Skip to content

Commit

Permalink
fix edge case when street name matcher finds no names at all
Browse files Browse the repository at this point in the history
  • Loading branch information
breunigs committed Jul 5, 2024
1 parent 517633b commit 4896f85
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/video/track.ex
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@ defmodule Video.Track do
@spec compact_street_names([Video.TimedPoint.t()], hash(), render_opts_priv()) :: timed_info()
defp compact_street_names(_coords, _hash, %{street_names: false}), do: []

defp compact_street_names(coords, hash, _opts) do
defp compact_street_names(coords, hash, _opts) when is_list(coords) do
map_matcher = Application.get_env(:veloroute, :map_matcher)

with {:ok, matched} <- map_matcher.match(coords) do
matched
|> Enum.reduce(nil, fn
coord, nil ->
|> Enum.reduce([], fn
coord, list when list == [] ->
[%{timestamp: coord.time_offset_ms, text: coord.match_name}]

%{match_name: name}, [%{text: name} | _rest] = list ->
Expand Down

0 comments on commit 4896f85

Please sign in to comment.