Fixed NPE on unloading plugins

By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2011-10-11 04:41:34 +01:00
parent ef674c0b83
commit f22a79981c

View file

@ -242,7 +242,7 @@ public class JavaPluginLoader implements PluginLoader {
public void removeClass(String name) { public void removeClass(String name) {
Class<?> clazz = classes.remove(name); Class<?> clazz = classes.remove(name);
if (ConfigurationSerializable.class.isAssignableFrom(clazz)) { if ((clazz != null) && (ConfigurationSerializable.class.isAssignableFrom(clazz))) {
Class<? extends ConfigurationSerializable> serializable = (Class<? extends ConfigurationSerializable>)clazz; Class<? extends ConfigurationSerializable> serializable = (Class<? extends ConfigurationSerializable>)clazz;
ConfigurationSerialization.unregisterClass(serializable); ConfigurationSerialization.unregisterClass(serializable);
} }