From 3418b82dc5f06062f93520e202399d596b9adcfe Mon Sep 17 00:00:00 2001
From: Omar Roth <omarroth@hotmail.com>
Date: Sun, 18 Nov 2018 17:47:40 -0600
Subject: [PATCH] Fix typo in autoplay

---
 src/invidious/views/watch.ecr | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index 16634948..5326faef 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -177,7 +177,7 @@
 <% if !rvs.empty? && !plid && params[:continue] %>
 player.on('ended', function() {
     window.location.replace("/watch?v=" 
-        + "<%= rvs.select { |rv| rv["id"]? }[0]? %>"
+        + "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>"
         + "&continue=1"
         <% if params[:listen] %>
         + "&listen=1"
@@ -196,7 +196,7 @@ function continue_autoplay(target) {
     if (target.checked) {
         player.on('ended', function() {
             window.location.replace("/watch?v=" 
-                + "<%= rvs.select { |rv| rv["id"]? }[0]? %>"
+                + "<%= rvs.select { |rv| rv["id"]? }[0]?.try &.["id"] %>"
                 + "&continue=1"
                 <% if params[:listen] %>
                 + "&listen=1"