From 5d56469f49862026cba3bda7a4a34feca7fe9818 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 20 Oct 2025 22:00:13 +0200 Subject: Fix crash when specifying negative crops in the player. --- src/tools/dcpomatic_player.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/tools') diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 1ea88d738..a6ed4e4b9 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -560,10 +560,10 @@ public: int pixels = 0; if (*crop_to_ratio > (2048.0 / 1080.0)) { pixels = (size.height - (size.width / *crop_to_ratio)) / 2; - _film->content()[0]->video->set_crop(Crop{0, 0, pixels, pixels}); + _film->content()[0]->video->set_crop(Crop{0, 0, std::max(0, pixels), std::max(0, pixels)}); } else { pixels = (size.width - (size.height * *crop_to_ratio)) / 2; - _film->content()[0]->video->set_crop(Crop{pixels, pixels, 0, 0}); + _film->content()[0]->video->set_crop(Crop{std::max(0, pixels), std::max(0, pixels), 0, 0}); } } } -- cgit v1.2.3