diff options
author | AlphaBlend <whizkid3000@hotmail.com> | 2013-04-04 17:00:26 -0700 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2013-08-07 02:26:10 -0500 |
commit | 15971ef69642634a785d7bb0b46f970b34839d15 (patch) | |
tree | 426c1e029cd57f19948f25d306523813fdbb2b8b /src/main/java/org | |
parent | 84c6c70b9003433714552ca733a6b38ad5c84208 (diff) | |
download | bukkit-15971ef69642634a785d7bb0b46f970b34839d15.tar bukkit-15971ef69642634a785d7bb0b46f970b34839d15.tar.gz bukkit-15971ef69642634a785d7bb0b46f970b34839d15.tar.lz bukkit-15971ef69642634a785d7bb0b46f970b34839d15.tar.xz bukkit-15971ef69642634a785d7bb0b46f970b34839d15.zip |
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.
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/metadata/MetadataStoreBase.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java index f46e1ec9..28f35fd1 100644 --- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java +++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java @@ -25,8 +25,8 @@ public abstract class MetadataStoreBase<T> { * @throws IllegalArgumentException If value is null, or the owning plugin is null */ public synchronized void setMetadata(T subject, String metadataKey, MetadataValue newMetadataValue) { - Plugin owningPlugin = newMetadataValue.getOwningPlugin(); Validate.notNull(newMetadataValue, "Value cannot be null"); + Plugin owningPlugin = newMetadataValue.getOwningPlugin(); Validate.notNull(owningPlugin, "Plugin cannot be null"); String key = disambiguate(subject, metadataKey); Map<Plugin, MetadataValue> entry = metadataMap.get(key); |