fix npe parsing quest challenges without difficulty

This commit is contained in:
Maxmtg
2013-07-02 10:55:54 +00:00
parent 60c2ab84d8
commit 6d30afb166

View File

@@ -1,5 +1,7 @@
package forge.quest;
import org.apache.commons.lang3.StringUtils;
/**
* TODO: Write javadoc for this type.
*
@@ -21,6 +23,9 @@ public enum QuestEventDifficulty {
}
public static QuestEventDifficulty fromString(String src) {
if ( StringUtils.isBlank(src) )
return MEDIUM; // player have custom files, that didn't specify a valid difficulty
for(QuestEventDifficulty qd : QuestEventDifficulty.values()) {
if( src.equalsIgnoreCase(qd.inFile) || src.equalsIgnoreCase(qd.name()) )
return qd;