Skip to content

Commit e8f8317

Browse files
committed
Fix/improve handling of two exceptions
1 parent d9df698 commit e8f8317

File tree

2 files changed

+14
-6
lines changed
  • BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/plugin
  • BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/lowres

2 files changed

+14
-6
lines changed

BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/plugin/Plugin.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,16 @@ public void onPlayerLeave(UUID playerUuid) {
486486

487487
private void checkPausedByPlayerCountSoon() {
488488
// check is done a second later to make sure the player has actually joined/left and is no longer on the list
489-
daemonTimer.schedule(new TimerTask() {
490-
@Override
491-
public void run() {
492-
checkPausedByPlayerCount();
493-
}
494-
}, 1000);
489+
try {
490+
daemonTimer.schedule(new TimerTask() {
491+
@Override
492+
public void run() {
493+
checkPausedByPlayerCount();
494+
}
495+
}, 1000);
496+
} catch (IllegalStateException ex) { // Timer is cancelled for some reason
497+
Logger.global.logWarning("Timer is already cancelled, skipping player-limit checks!");
498+
}
495499
}
496500

497501
public boolean checkPausedByPlayerCount() {

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/lowres/LowresTile.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public LowresTile(Vector2i tileSize, InputStream in) throws IOException {
2828
this.size = tileSize.add(1, 1); // add 1 for seamless edges
2929
this.texture = ImageIO.read(in);
3030

31+
if (this.texture == null) {
32+
throw new IOException("No registered ImageReader is able to read the image-stream");
33+
}
34+
3135
if (this.texture.getWidth() != this.size.getX() || this.texture.getHeight() != this.size.getY() * 2) {
3236
throw new IOException("Size of tile does not match");
3337
}

0 commit comments

Comments
 (0)