Fixed silly NPE during shutdown when java becomes a meanie-pants and steals our lunch money :(

By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2011-12-09 17:13:47 +00:00
parent a41e663ef3
commit f63d8e600d

View file

@ -241,10 +241,15 @@ public class JavaPluginLoader implements PluginLoader {
public void removeClass(String name) {
Class<?> clazz = classes.remove(name);
if ((clazz != null) && (ConfigurationSerializable.class.isAssignableFrom(clazz))) {
Class<? extends ConfigurationSerializable> serializable = (Class<? extends ConfigurationSerializable>)clazz;
ConfigurationSerialization.unregisterClass(serializable);
try {
if ((clazz != null) && (ConfigurationSerializable.class.isAssignableFrom(clazz))) {
Class<? extends ConfigurationSerializable> serializable = (Class<? extends ConfigurationSerializable>)clazz;
ConfigurationSerialization.unregisterClass(serializable);
}
} catch (NullPointerException ex) {
// Boggle!
// (Native methods throwing NPEs is not fun when you can't stop it before-hand)
}
}