Fixed a bug in random generation where selecting a set which had no basic lands caused an error. Partially fixes #1242

This commit is contained in:
Simown 2015-09-03 19:40:12 +01:00
parent 5a812f022d
commit 14148b25db

View file

@ -396,7 +396,8 @@ public class DeckGenerator {
private static Card getBasicLand(ColoredManaSymbol color, Map<String, List<CardInfo>> basicLands) {
Random random = new Random();
String landName = DeckGeneratorPool.getBasicLandName(color.toString());
return basicLands.get(landName).get(random.nextInt(basicLands.size() - 1)).getMockCard().copy();
List<CardInfo> basicLandsInfo = basicLands.get(landName);
return basicLandsInfo.get(random.nextInt(basicLandsInfo.size() - 1)).getMockCard().copy();
}