Fixed NPE if no available sets to draft from in quest mode.

This commit is contained in:
Krazy
2014-10-07 21:45:08 +00:00
parent 0f9865c4d3
commit 1b5f9d257b

View File

@@ -747,9 +747,16 @@ public class QuestEventDraft {
* @return The created draft or null in the event no draft could be created. * @return The created draft or null in the event no draft could be created.
*/ */
public static QuestEventDraft getRandomDraftOrNull(final QuestController quest) { public static QuestEventDraft getRandomDraftOrNull(final QuestController quest) {
List<CardBlock> possibleBlocks = getAvailableBlocks(quest); List<CardBlock> possibleBlocks = getAvailableBlocks(quest);
if (possibleBlocks == null) {
return null;
}
Collections.shuffle(possibleBlocks); Collections.shuffle(possibleBlocks);
return getDraftOrNull(quest, possibleBlocks.get(0)); return getDraftOrNull(quest, possibleBlocks.get(0));
} }
/** /**