--- mythplugins/mythmusic/mythmusic/cdrip.cpp	2020-03-23 14:32:28.000000000 +0000
+++ /tmp/cdrip.cpp	2020-06-14 14:31:13.070846014 +0100
@@ -325,7 +325,18 @@
                                                   titleTrack));
                 }
 
-                if (!encoder->isValid())
+                if (!encoder)
+                {
+                    // This should never happen.
+                    QApplication::postEvent(
+                        m_parent,
+                        new RipStatusEvent(RipStatusEvent::kEncoderErrorEvent,
+                                           "Failed to create encoder"));
+                    LOG(VB_GENERAL, LOG_ERR, "MythMusic: No encoder, failing");
+                    RunEpilog();
+                    return;
+                }
+                else if (!encoder->isValid())
                 {
                     QApplication::postEvent(
                         m_parent,
@@ -340,18 +351,10 @@
                 }
             }
 
-            if (!encoder)
+            if (encoder)
             {
-                // This should never happen.
-                QApplication::postEvent(
-                    m_parent,
-                    new RipStatusEvent(RipStatusEvent::kEncoderErrorEvent,
-                                       "Failed to create encoder"));
-                LOG(VB_GENERAL, LOG_ERR, "MythMusic: No encoder, failing");
-                RunEpilog();
-                return;
+                ripTrack(m_cdDevice, encoder.get(), trackno + 1);
             }
-            ripTrack(m_cdDevice, encoder.get(), trackno + 1);
 
             if (isCancelled())
             {
