Index: ui/file_manager/video_player/js/video_player.js |
diff --git a/ui/file_manager/video_player/js/video_player.js b/ui/file_manager/video_player/js/video_player.js |
index 6ea56b53d45e457b521c4d77b698ab7bd989b7b9..9dcb7c18aaeef126528b31faf4f06d88484efc9f 100644 |
--- a/ui/file_manager/video_player/js/video_player.js |
+++ b/ui/file_manager/video_player/js/video_player.js |
@@ -594,8 +594,10 @@ VideoPlayer.prototype.updateCheckOnCastMenu_ = function() { |
*/ |
VideoPlayer.prototype.onCurrentCastDisappear_ = function() { |
this.currentCast_ = null; |
- this.currentSession_.removeUpdateListener(this.onCastSessionUpdateBound_); |
- this.currentSession_ = null; |
+ if (this.currentSession_) { |
+ this.currentSession_.removeUpdateListener(this.onCastSessionUpdateBound_); |
+ this.currentSession_ = null; |
+ } |
this.controls.showErrorMessage('GALLERY_VIDEO_DECODING_ERROR'); |
this.unloadVideo(); |
}; |