swaroop: fix crash when there's an incorrect ecinema KDM.
[dcpomatic.git] / src / wx / swaroop_controls.cc
index e7232e6f4d8b75b0d231066c2ed3ff9cfb1d63a3..5ce6c45fc7a637f6e6c1e99124d596f7698cb422 100644 (file)
@@ -201,6 +201,7 @@ SwaroopControls::deselect_playlist ()
                _selected_playlist = boost::none;
                _spl_view->SetItemState (selected, 0, wxLIST_STATE_SELECTED);
        }
+       ResetFilm (shared_ptr<Film>(new Film(optional<boost::filesystem::path>())));
 }
 
 void
@@ -488,7 +489,7 @@ SwaroopControls::select_playlist (int selected, int position)
                        }
                        if (dcp->needs_kdm()) {
                                /* We didn't get a KDM for this */
-                               error_dialog (this, "This playlist cannot be loaded as a KDM is missing.");
+                               error_dialog (this, "This playlist cannot be loaded as a KDM is missing or incorrect.");
                                deselect_playlist ();
                                return;
                        }
@@ -501,10 +502,12 @@ SwaroopControls::select_playlist (int selected, int position)
                                        ffmpeg->add_kdm (*kdm);
                                        ffmpeg->examine (_film, shared_ptr<Job>());
                                } catch (KDMError& e) {
-                                       error_dialog (this, "Could not load KDM.");
+                                       error_dialog (this, "This playlist cannot be loaded as a KDM is missing or incorrect.");
+                                       deselect_playlist ();
+                                       return;
                                }
                        } else {
-                               error_dialog (this, "This playlist cannot be loaded as a KDM is missing.");
+                               error_dialog (this, "This playlist cannot be loaded as a KDM is missing or incorrect.");
                                deselect_playlist ();
                                return;
                        }