Skip to content

Commit

Permalink
Add null checking for commentBox
Browse files Browse the repository at this point in the history
  • Loading branch information
vaishaliagola27 committed Dec 29, 2020
1 parent 4389ccc commit 26ef594
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/assets/js/rtMedia.backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -2944,6 +2944,9 @@ function rtmedia_disable_popup_navigation( $selector ){
*/
const rtMediaScrollComments = () => {
const commentBox = document.getElementById( 'rtmedia_comment_ul' );
const commentsToScroll = ( commentBox.offsetHeight ) * 1000;
commentBox.scrollTo( { top: commentsToScroll, behavior: 'smooth' } );

if ( commentBox !== null ) {
const commentsToScroll = ( commentBox.offsetHeight ) * 1000;
commentBox.scrollTo( { top: commentsToScroll, behavior: 'smooth' } );
}
}

0 comments on commit 26ef594

Please sign in to comment.