Check null before grabbing metadata owning plugin. Fixes BUKKIT-4665
MetadataStoreBase throws a NullPointerException when passed a null value for setMetaData. The intended behavior is to throw an IllegalArgumentException. This commit changes the value's null check to occur before referencing the owning plugin of a value.
This commit is contained in:
parent
84c6c70b90
commit
15971ef696
@ -25,8 +25,8 @@ public abstract class MetadataStoreBase<T> {
|
|||||||
* @throws IllegalArgumentException If value is null, or the owning plugin is null
|
* @throws IllegalArgumentException If value is null, or the owning plugin is null
|
||||||
*/
|
*/
|
||||||
public synchronized void setMetadata(T subject, String metadataKey, MetadataValue newMetadataValue) {
|
public synchronized void setMetadata(T subject, String metadataKey, MetadataValue newMetadataValue) {
|
||||||
Plugin owningPlugin = newMetadataValue.getOwningPlugin();
|
|
||||||
Validate.notNull(newMetadataValue, "Value cannot be null");
|
Validate.notNull(newMetadataValue, "Value cannot be null");
|
||||||
|
Plugin owningPlugin = newMetadataValue.getOwningPlugin();
|
||||||
Validate.notNull(owningPlugin, "Plugin cannot be null");
|
Validate.notNull(owningPlugin, "Plugin cannot be null");
|
||||||
String key = disambiguate(subject, metadataKey);
|
String key = disambiguate(subject, metadataKey);
|
||||||
Map<Plugin, MetadataValue> entry = metadataMap.get(key);
|
Map<Plugin, MetadataValue> entry = metadataMap.get(key);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user