Fix crash when setting player decode resolution with no loaded DCP (#1115).
authorCarl Hetherington <cth@carlh.net>
Sat, 19 Aug 2017 22:27:43 +0000 (23:27 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 19 Aug 2017 22:27:43 +0000 (23:27 +0100)
src/wx/film_viewer.cc

index 5052459276cd8434c6b72579299d1c15270408c2..9493a55c9ee7c949098dd28643cab9277f4ee899 100644 (file)
@@ -197,6 +197,9 @@ FilmViewer::set_film (shared_ptr<Film> film)
        try {
                _player.reset (new Player (_film, _film->playlist ()));
                _player->set_fast ();
+               if (_dcp_decode_reduction) {
+                       _player->set_dcp_decode_reduction (_dcp_decode_reduction);
+               }
        } catch (bad_alloc) {
                error_dialog (this, _("There is not enough free memory to do that."));
                _film.reset ();
@@ -811,7 +814,10 @@ FilmViewer::average_latency () const
 void
 FilmViewer::set_dcp_decode_reduction (optional<int> reduction)
 {
-       _player->set_dcp_decode_reduction (reduction);
+       _dcp_decode_reduction = reduction;
+       if (_player) {
+               _player->set_dcp_decode_reduction (reduction);
+       }
 }
 
 DCPTime