From 65895ac52ed072314080040f99978cdd77b5a5db Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 16 Jun 2023 21:14:42 +0200 Subject: Defend against divide by 0. --- src/wx/timeline.cc | 4 ++-- 1 file 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); -- cgit v1.2.3