diff options
| author | 2021-03-19 18:39:05 +0000 | |
|---|---|---|
| committer | 2021-03-19 18:39:05 +0000 | |
| commit | 923e2300e65e8f958a694d4e83041f116b7c4775 (patch) | |
| tree | 828c89180b72b04635a031e90d43eaabfdf2a476 /enigma-swing/src/main/java | |
| parent | Bump version (diff) | |
| download | enigma-fork-923e2300e65e8f958a694d4e83041f116b7c4775.tar.gz enigma-fork-923e2300e65e8f958a694d4e83041f116b7c4775.tar.xz enigma-fork-923e2300e65e8f958a694d4e83041f116b7c4775.zip | |
WIP full record support
Diffstat (limited to 'enigma-swing/src/main/java')
| -rw-r--r-- | enigma-swing/src/main/java/cuchaz/enigma/gui/config/UiConfig.java | 10 |
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 828da11..bfa2f38 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 | } |