From c301c316bfbbf3aa3f64e6c1f3a8f2154cd7ddbb Mon Sep 17 00:00:00 2001 From: Albert Yi Date: Fri, 19 Oct 2018 10:28:10 -0700 Subject: [PATCH] fix js error if there's no news update --- app/javascript/src/javascripts/news_updates.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/javascript/src/javascripts/news_updates.js b/app/javascript/src/javascripts/news_updates.js index d3f1490ce..1ce6b650f 100644 --- a/app/javascript/src/javascripts/news_updates.js +++ b/app/javascript/src/javascripts/news_updates.js @@ -3,6 +3,10 @@ import Cookie from './cookie' let NewsUpdate = {}; NewsUpdate.initialize = function() { + if (!$("#news-updates").length) { + return; + } + var key = $("#news-updates").data("id").toString(); if (Cookie.get("news-ticker") === key) {