Fix crash when pressing Ctrl+{C,V} at the wrong time.
[dcpomatic.git] / src / tools / dcpomatic.cc
index d6b6bc2b72aaba15126950ebdf4244c7e051d260..bd5cbaa7a762f87fc025dd0257b9d6b9b8db6e99 100644 (file)
@@ -388,6 +388,7 @@ public:
                left_panel->SetSizerAndFit(left_sizer);
 
                _controls = new StandardControls(_right_panel, _film_viewer, true);
+               _controls->set_film(_film_viewer.film());
                auto job_manager_view = new JobManagerView(_right_panel, false);
 
                auto right_sizer = new wxBoxSizer (wxVERTICAL);
@@ -706,13 +707,16 @@ private:
        void edit_copy ()
        {
                auto const sel = _film_editor->content_panel()->selected();
-               DCPOMATIC_ASSERT (sel.size() == 1);
-               _clipboard = sel.front()->clone();
+               if (sel.size() == 1) {
+                       _clipboard = sel.front()->clone();
+               }
        }
 
        void edit_paste ()
        {
-               DCPOMATIC_ASSERT (_clipboard);
+               if (!_clipboard) {
+                       return;
+               }
 
                PasteDialog dialog(this, static_cast<bool>(_clipboard->video), static_cast<bool>(_clipboard->audio), !_clipboard->text.empty());
                if (dialog.ShowModal() != wxID_OK) {
@@ -1820,8 +1824,10 @@ private:
 
        void close_splash ()
        {
-               _splash->Destroy();
-               _splash = nullptr;
+               if (_splash) {
+                       _splash->Destroy();
+                       _splash = nullptr;
+               }
        }
 
        void config_failed_to_load (Config::LoadFailure what)
@@ -1908,7 +1914,7 @@ private:
        }
 
        DOMFrame* _frame = nullptr;
-       wxSplashScreen* _splash;
+       wxSplashScreen* _splash = nullptr;
        shared_ptr<wxTimer> _timer;
        string _film_to_load;
        string _film_to_create;