From 6f935f3449a3cfe7a64a8454a295688d41f2e733 Mon Sep 17 00:00:00 2001 From: edwloef Date: Thu, 29 May 2025 23:55:05 +0200 Subject: [PATCH] fix underflow when calculating new bounds --- core/src/rectangle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index 44c29287..8ffb0797 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -246,8 +246,8 @@ impl Rectangle { let top_left = self.position().snap(); let bottom_right = (self.position() + self.size().into()).snap(); - let width = bottom_right.x - top_left.x; - let height = bottom_right.y - top_left.y; + let width = bottom_right.x.checked_sub(top_left.x)?; + let height = bottom_right.y.checked_sub(top_left.y)?; if width < 1 || height < 1 { return None;