summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-06-16 21:14:42 +0200
committerCarl Hetherington <cth@carlh.net>2023-06-16 21:14:42 +0200
commit65895ac52ed072314080040f99978cdd77b5a5db (patch)
tree64aae3141bcafba317aa28490ddfa3f849c63122
parent1758421caa406e1ec72bf96fee87eaa32d283896 (diff)
Defend against divide by 0.
-rw-r--r--src/wx/timeline.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc
index 5cf84dfd5..c6ce1527b 100644
--- a/src/wx/timeline.cc
+++ b/src/wx/timeline.cc
@@ -950,8 +950,8 @@ Timeline::zoom_all ()
{
auto film = _film.lock ();
DCPOMATIC_ASSERT (film);
- set_pixels_per_second ((_main_canvas->GetSize().GetWidth() - 32) / film->length().seconds());
- set_pixels_per_track ((_main_canvas->GetSize().GetHeight() - tracks_y_offset() - _time_axis_view->bbox().height - 32) / _tracks);
+ set_pixels_per_second((_main_canvas->GetSize().GetWidth() - 32) / std::max(1.0, film->length().seconds()));
+ set_pixels_per_track((_main_canvas->GetSize().GetHeight() - tracks_y_offset() - _time_axis_view->bbox().height - 32) / std::max(1, _tracks));
setup_scrollbars ();
_main_canvas->Scroll (0, 0);
_labels_canvas->Scroll (0, 0);