Fix handling of empty strings passed to Block/ItemType

Dieser Commit ist enthalten in:
zml2008 2012-01-24 19:27:17 -08:00
Ursprung 29fd98879d
Commit 71fc98ba1c
2 geänderte Dateien mit 8 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -237,6 +237,10 @@ public enum BlockType {
public static BlockType lookup(String name, boolean fuzzy) { public static BlockType lookup(String name, boolean fuzzy) {
String testName = name.replace(" ", "").toLowerCase(); String testName = name.replace(" ", "").toLowerCase();
if (testName.length() == 0) {
return null;
}
BlockType type = lookup.get(testName); BlockType type = lookup.get(testName);
if (type != null) { if (type != null) {

Datei anzeigen

@ -415,6 +415,10 @@ public enum ItemType {
public static ItemType lookup(String name, boolean fuzzy) { public static ItemType lookup(String name, boolean fuzzy) {
String testName = name.replace(" ", "").toLowerCase(); String testName = name.replace(" ", "").toLowerCase();
if (testName.length() == 0) {
return null;
}
ItemType type = lookup.get(testName); ItemType type = lookup.get(testName);
if (type != null) { if (type != null) {