add null safety to clip parsing

This commit is contained in:
ChunkyProgrammer
2023-12-19 22:37:48 -05:00
parent b344d98c25
commit 7da4a7f72b
2 changed files with 6 additions and 4 deletions

View File

@@ -277,8 +277,8 @@ module Invidious::Routes::Watch
if video_id = response.dig?("endpoint", "watchEndpoint", "videoId")
if params = response.dig?("endpoint", "watchEndpoint", "params").try &.as_s
start_time, end_time, _ = parse_clip_parameters(params)
env.params.query["start"] = start_time.to_s
env.params.query["end"] = end_time.to_s
env.params.query["start"] = start_time.to_s if start_time != nil
env.params.query["end"] = end_time.to_s if end_time != nil
end
return env.redirect "/watch?v=#{video_id}&#{env.params.query}"