diff options
author | md_5 <git@md-5.net> | 2018-04-08 20:03:12 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-04-08 20:03:12 +1000 |
commit | 9060bfa9b969a97399f14ab4dbb3aebe61d4a9fc (patch) | |
tree | 2f096a60fa7a496f1d89eebf1cbd1b76ce92179e | |
parent | fb423b8f48335d0dc6c88cd8a24ee07d82ae09a8 (diff) | |
download | craftbukkit-9060bfa9b969a97399f14ab4dbb3aebe61d4a9fc.tar craftbukkit-9060bfa9b969a97399f14ab4dbb3aebe61d4a9fc.tar.gz craftbukkit-9060bfa9b969a97399f14ab4dbb3aebe61d4a9fc.tar.lz craftbukkit-9060bfa9b969a97399f14ab4dbb3aebe61d4a9fc.tar.xz craftbukkit-9060bfa9b969a97399f14ab4dbb3aebe61d4a9fc.zip |
SPIGOT-3886: Plugin exceptions in map rendering should not crash server
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java | 1 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java index 1c3e1981..7372614c 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java +++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java @@ -93,6 +93,7 @@ public class CraftMapCanvas implements MapCanvas { } catch (NumberFormatException ex) {} } + throw new IllegalArgumentException("Text contains unterminated color string"); } CharacterSprite sprite = font.getChar(text.charAt(i)); diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java index 625ef96b..b951bfda 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java +++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; import net.minecraft.server.WorldMap; @@ -143,7 +144,11 @@ public final class CraftMapView implements MapView { } canvas.setBase(render.buffer); - renderer.render(this, canvas, player); + try { + renderer.render(this, canvas, player); + } catch (Throwable ex) { + Bukkit.getLogger().log(Level.SEVERE, "Could not render map using renderer " + renderer.getClass().getName(), ex); + } byte[] buf = canvas.getBuffer(); for (int i = 0; i < buf.length; ++i) { |