summaryrefslogtreecommitdiff
path: root/enigma-swing/src/main/java/cuchaz
diff options
context:
space:
mode:
Diffstat (limited to 'enigma-swing/src/main/java/cuchaz')
-rw-r--r--enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java
index 828da116..bfa2f389 100644
--- a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java
+++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java
@@ -258,7 +258,15 @@ public final class UiConfig {
258 OptionalInt x = section.getInt(String.format("X %s", screenSize.width)); 258 OptionalInt x = section.getInt(String.format("X %s", screenSize.width));
259 OptionalInt y = section.getInt(String.format("Y %s", screenSize.height)); 259 OptionalInt y = section.getInt(String.format("Y %s", screenSize.height));
260 if (x.isPresent() && y.isPresent()) { 260 if (x.isPresent() && y.isPresent()) {
261 return new Point(x.getAsInt(), y.getAsInt()); 261 int ix = x.getAsInt();
262 int iy = y.getAsInt();
263
264 // Ensure that the position is on the screen.
265 if (ix < 0 || iy < 0 || ix > screenSize.width || iy > screenSize.height) {
266 return fallback;
267 }
268
269 return new Point(ix, iy);
262 } else { 270 } else {
263 return fallback; 271 return fallback;
264 } 272 }