From 974da59fc893f8e1bccf1d93805257c61f60ffde Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 10 Jan 2024 15:58:26 +0000 Subject: [PATCH] Make window clamping more robust for invalid values --- app/src/main/java/io/xpipe/app/core/AppWindowHelper.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/io/xpipe/app/core/AppWindowHelper.java b/app/src/main/java/io/xpipe/app/core/AppWindowHelper.java index 317150d8e..8795025fb 100644 --- a/app/src/main/java/io/xpipe/app/core/AppWindowHelper.java +++ b/app/src/main/java/io/xpipe/app/core/AppWindowHelper.java @@ -269,6 +269,11 @@ public class AppWindowHelper { changed = true; } + // This should not happen but on weird Linux systems nothing is impossible + if (w < 0 || h < 0) { + return Optional.empty(); + } + return changed ? Optional.of(new Rectangle2D(x, y, w, h)) : Optional.empty(); }