From 71fc98ba1c0f40c84a01db829a3f6bc08f096153 Mon Sep 17 00:00:00 2001 From: zml2008 Date: Tue, 24 Jan 2012 19:27:17 -0800 Subject: [PATCH] Fix handling of empty strings passed to Block/ItemType --- src/main/java/com/sk89q/worldedit/blocks/BlockType.java | 4 ++++ src/main/java/com/sk89q/worldedit/blocks/ItemType.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/com/sk89q/worldedit/blocks/BlockType.java b/src/main/java/com/sk89q/worldedit/blocks/BlockType.java index 253d9f0c8..aebd29597 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/BlockType.java +++ b/src/main/java/com/sk89q/worldedit/blocks/BlockType.java @@ -236,6 +236,10 @@ public enum BlockType { */ public static BlockType lookup(String name, boolean fuzzy) { String testName = name.replace(" ", "").toLowerCase(); + + if (testName.length() == 0) { + return null; + } BlockType type = lookup.get(testName); diff --git a/src/main/java/com/sk89q/worldedit/blocks/ItemType.java b/src/main/java/com/sk89q/worldedit/blocks/ItemType.java index 5cd04dffb..e6f995d3f 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/ItemType.java +++ b/src/main/java/com/sk89q/worldedit/blocks/ItemType.java @@ -414,6 +414,10 @@ public enum ItemType { */ public static ItemType lookup(String name, boolean fuzzy) { String testName = name.replace(" ", "").toLowerCase(); + + if (testName.length() == 0) { + return null; + } ItemType type = lookup.get(testName);