From 864485e46b11c3cd77f5bc77e6cdc886f482c5d4 Mon Sep 17 00:00:00 2001 From: Mason Ballengee Date: Thu, 7 Dec 2023 16:52:47 -0500 Subject: [PATCH] Add safe navigator to captions check Encountered an issue on avalon-dev where `@master_file.captions` returned nil instead of an empty Indexed file so the subsequent check for content errored. This prevents the HLS manifest from generating, causing streaming to fail. I think this will be encountered with any item created after we changed how captions are created/stored. Adding the safe navigator should take care of the issue. --- app/views/master_files/hls_manifest.m3u8.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/master_files/hls_manifest.m3u8.erb b/app/views/master_files/hls_manifest.m3u8.erb index 47eb8c5f18..7541925d68 100644 --- a/app/views/master_files/hls_manifest.m3u8.erb +++ b/app/views/master_files/hls_manifest.m3u8.erb @@ -16,7 +16,7 @@ Unless required by applicable law or agreed to in writing, software distributed #EXTM3U <% if @master_file.has_captions? %> <% captions_list = @master_file.supplemental_file_captions %> -<% captions_list.append(@master_file.captions) if @master_file.captions.content %> +<% captions_list.append(@master_file.captions) if @master_file.captions&.content %> <% captions_list.each_with_index do |caption, index| %> <% label = caption.is_a?(SupplementalFile) ? caption.label : 'English' %> <% language = caption.is_a?(SupplementalFile) ? caption.language : 'en' %>