From 98ab60a2757b50d6e4f6de4490e83f6168faffc0 Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Thu, 8 Oct 2020 20:46:46 +0200 Subject: [PATCH] Fix possible crash --- src/mediaview.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mediaview.cpp b/src/mediaview.cpp index c06444f0..cf800ff3 100644 --- a/src/mediaview.cpp +++ b/src/mediaview.cpp @@ -414,6 +414,7 @@ void MediaView::mediaStateChanged(Media::State state) { if (pauseTime > 0 && (state == Media::PlayingState || state == Media::BufferingState)) { qDebug() << "Seeking to" << pauseTime; media->seek(pauseTime); + media->play(); pauseTime = 0; } if (state == Media::PlayingState) { @@ -444,9 +445,12 @@ void MediaView::pause() { default: if (pauseTimer.hasExpired(60000)) { pauseTimer.invalidate(); - connect(playlistModel->activeVideo(), &Video::gotStreamUrl, this, - &MediaView::resumeWithNewStreamUrl); - playlistModel->activeVideo()->loadStreamUrl(); + auto activeVideo = playlistModel->activeVideo(); + if (activeVideo) { + connect(activeVideo, &Video::gotStreamUrl, this, + &MediaView::resumeWithNewStreamUrl); + activeVideo->loadStreamUrl(); + } } else media->play(); break;