Fix potential crash.
authorCarl Hetherington <cth@carlh.net>
Thu, 11 Oct 2012 23:24:06 +0000 (00:24 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 11 Oct 2012 23:24:06 +0000 (00:24 +0100)
src/wx/film_viewer.cc

index 0caa296ef0e700261246fad08eb2e9deeee44e0a..fb7317dc6691ae2d30f3da1bc60e2b5e3ce80856 100644 (file)
@@ -49,6 +49,11 @@ public:
        /** Handle a paint event */
        void paint_event (wxPaintEvent& ev)
        {
+               if (!_film) {
+                       wxPaintDC dc (this);
+                       return;
+               }
+               
                if (_frame_rebuild_needed) {
                        _image.reset (new wxImage (std_to_wx (_film->thumb_file (_index))));
 
@@ -74,7 +79,7 @@ public:
                        dc.DrawBitmap (*_bitmap, 0, 0, false);
                }
 
-               if (_film && _film->with_subtitles ()) {
+               if (_film->with_subtitles ()) {
                        for (list<SubtitleView>::iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
                                dc.DrawBitmap (*i->bitmap, i->cropped_position.x, i->cropped_position.y, true);
                        }