SPIGOT-3886: Plugin exceptions in map rendering should not crash server

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2018-04-08 20:03:12 +10:00
parent 10a070d7a2
commit d54b9c77e9
2 changed files with 7 additions and 1 deletions

View file

@ -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));

View file

@ -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) {