Fix exception when getting 404 in video watch
authorChocobozzz <florian.bigard@gmail.com>
Mon, 9 Oct 2017 09:25:41 +0000 (11:25 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Mon, 9 Oct 2017 09:25:41 +0000 (11:25 +0200)
client/src/app/videos/video-watch/video-watch.component.ts

index dbe391fff54e3497beb633fa402fd8a5cd18fe8f..db3e1cdd6e9f3795c9dc128121b4b9701c9661bd 100644 (file)
@@ -66,11 +66,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
   }
 
   ngOnDestroy () {
-    // Remove WebTorrent stuff
-    console.log('Removing video from webtorrent.')
-
-    // Remove player
-    videojs(this.playerElement).dispose()
+    // Remove player if it exists
+    if (this.videoNotFound === false) {
+      videojs(this.playerElement).dispose()
+    }
 
     // Unsubscribe subscriptions
     this.paramsSub.unsubscribe()