From 6181e52c4719e31e2c644989ffe1c71783865f62 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 20 Sep 2018 09:07:28 -0400 Subject: [PATCH] gracefully handle non-existence of imageFeed --- web/skins/classic/views/js/event.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js index 59dd5052a..a96aa399b 100644 --- a/web/skins/classic/views/js/event.js +++ b/web/skins/classic/views/js/event.js @@ -239,7 +239,7 @@ function getCmdResponse( respObj, respText ) { if ( streamStatus.auth ) { // Try to reload the image stream. - var streamImg = document.getElementById('evtStream'); + var streamImg = $j('#evtStream'); if ( streamImg ) streamImg.src = streamImg.src.replace( /auth=\w+/i, 'auth='+streamStatus.auth ); } // end if haev a new auth hash @@ -992,10 +992,15 @@ function initPage() { progressBarNav (); streamCmdTimer = streamQuery.delay( 250 ); if ( canStreamNative ) { - var streamImg = $('imageFeed').getElement('img'); - if ( !streamImg ) - streamImg = $('imageFeed').getElement('object'); - $(streamImg).addEvent( 'click', function( event ) { handleClick( event ); } ); + var imageFeed = $('imageFeed'); + if ( !imageFeed ) { + console.log('No element with id tag imageFeed found.'); + } else { + var streamImg = imageFeed.getElement('img'); + if ( !streamImg ) + streamImg = imageFeed.getElement('object'); + $(streamImg).addEvent( 'click', function( event ) { handleClick( event ); } ); + } } } nearEventsQuery(eventData.Id);