summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-25 23:50:15 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-25 23:50:15 +0100
commitc252bea0407deedad31c67ab7dd5de4890cafd53 (patch)
treecf4c79227e37e77bbf31cabeb095a242f40d771a /src
parent1424e414e163299e576ed816abb0962351d4b6c1 (diff)
Fix crash on scaling the ccap window to be very small.
Diffstat (limited to 'src')
-rw-r--r--src/wx/closed_captions_dialog.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/wx/closed_captions_dialog.cc b/src/wx/closed_captions_dialog.cc
index 857db66a8..1e13f867a 100644
--- a/src/wx/closed_captions_dialog.cc
+++ b/src/wx/closed_captions_dialog.cc
@@ -23,6 +23,7 @@
#include <boost/bind.hpp>
using std::list;
+using std::max;
using std::cout;
using std::make_pair;
using boost::shared_ptr;
@@ -57,7 +58,7 @@ ClosedCaptionsDialog::paint ()
dc.SetTextForeground (*wxWHITE);
/* Choose a font which fits vertically */
- int const line_height = dc.GetSize().GetHeight() / _num_lines;
+ int const line_height = max (8, dc.GetSize().GetHeight() / _num_lines);
wxFont font (*wxNORMAL_FONT);
font.SetPixelSize (wxSize (0, line_height * 0.8));
dc.SetFont (font);