From 0fdf96aef4d8ab78bc66d9e9d25a9530856c2b2d Mon Sep 17 00:00:00 2001 From: Frithjof Winkelmann Date: Wed, 2 Oct 2024 10:48:09 +0200 Subject: [PATCH] Fix agl image endpoint on empty flight cones --- backend-rust/src/bin/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/backend-rust/src/bin/main.rs b/backend-rust/src/bin/main.rs index 1e98864..685e6d3 100644 --- a/backend-rust/src/bin/main.rs +++ b/backend-rust/src/bin/main.rs @@ -351,8 +351,17 @@ fn get_agl_image<'a>( } } - imgx = (x_upper - x_lower) + 1; - imgy = (y_upper - y_lower) + 1; + if x_lower == usize::MAX { + imgx = 1; + imgy = 1; + x_lower = 0; + x_upper = 0; + y_lower = 0; + y_upper = 0; + } else { + imgx = (x_upper - x_lower) + 1; + imgy = (y_upper - y_lower) + 1; + } let heights_sub = heights.slice(s![x_lower..(x_upper + 1), y_lower..(y_upper + 1)]);