summaryrefslogtreecommitdiff
path: root/enigma-swing/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'enigma-swing/src/main')
-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 bab50df1..e4adadf1 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
@@ -272,7 +272,15 @@ public final class UiConfig {
272 OptionalInt x = section.getInt(String.format("X %s", screenSize.width)); 272 OptionalInt x = section.getInt(String.format("X %s", screenSize.width));
273 OptionalInt y = section.getInt(String.format("Y %s", screenSize.height)); 273 OptionalInt y = section.getInt(String.format("Y %s", screenSize.height));
274 if (x.isPresent() && y.isPresent()) { 274 if (x.isPresent() && y.isPresent()) {
275 return new Point(x.getAsInt(), y.getAsInt()); 275 int ix = x.getAsInt();
276 int iy = y.getAsInt();
277
278 // Ensure that the position is on the screen.
279 if (ix < 0 || iy < 0 || ix > screenSize.width || iy > screenSize.height) {
280 return fallback;
281 }
282
283 return new Point(ix, iy);
276 } else { 284 } else {
277 return fallback; 285 return fallback;
278 } 286 }