Make window clamping more robust for invalid values

This commit is contained in:
crschnick 2024-01-10 15:58:26 +00:00
parent 54dff11353
commit 974da59fc8

View file

@ -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();
}