mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-15 03:52:12 +01:00
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. By: AlphaBlend <whizkid3000@hotmail.com>
This commit is contained in:
parent
d8cfc3fa42
commit
121764ab61
@ -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…
Reference in New Issue
Block a user