Account for tracks with nil length

This commit is contained in:
Claudio Ortolina
2025-05-05 16:18:33 +01:00
parent e1938f698c
commit 79d2bdff7b
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ defmodule MusicBrainz.Release do
end
def medium_duration(medium) do
Enum.sum_by(medium.tracks, fn track -> track.length end)
Enum.sum_by(medium.tracks, fn track -> track.length || 0 end)
end
def from_api_response(r) do
@@ -316,7 +316,7 @@
<span class="table-cell text-xs text-right pr-1">{track.position}</span>
<span class="table-cell text-xs font-medium leading-8">{track.title}</span>
<span class="table-cell text-xs text-right pl-2">
{format_duration(track.length)}
{track.length && format_duration(track.length)}
</span>
</div>
<div :if={release_with_tracks.artists !== track.artists} class="table-row text-xs">