summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-05-23 15:30:28 +0200
committerLaurenz <laurmaedje@gmail.com>2023-05-23 15:30:28 +0200
commit363836a28e4c8877b7c5203ed4ce595a59731802 (patch)
tree0f376023f81e3db69a3c1641a0db4136a7b7d3a8 /src
parentf2193307c48055e54d4d1b5eca43bf0189699d40 (diff)
Fix layout panic in rounded rectangle
Fixes #1216 both by hardening the rounded rectangle against negative size and by ensuring that the negative size doesn't occur in the first place for this case.
Diffstat (limited to 'src')
-rw-r--r--src/geom/rounded.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/geom/rounded.rs b/src/geom/rounded.rs
index f445dfcb..24b52448 100644
--- a/src/geom/rounded.rs
+++ b/src/geom/rounded.rs
@@ -52,7 +52,7 @@ fn stroke_segments(
let mut connection = Connection::default();
let mut path = Path::new();
let mut always_continuous = true;
- let max_radius = size.x.min(size.y) / 2.0;
+ let max_radius = size.x.min(size.y).max(Abs::zero()) / 2.0;
for side in [Side::Top, Side::Right, Side::Bottom, Side::Left] {
let continuous = stroke.get_ref(side) == stroke.get_ref(side.next_cw());