From 5ec4cafd9ed9966c0af6b3f33f78cc833950ee0c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 12 Oct 2012 00:24:06 +0100 Subject: [PATCH] Fix potential crash. --- src/wx/film_viewer.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 0caa296ef..fb7317dc6 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -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::iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) { dc.DrawBitmap (*i->bitmap, i->cropped_position.x, i->cropped_position.y, true); } -- 2.30.2