From caa07069b408121be8c38ae83f75c10ac5035c11 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 27 Nov 2012 17:18:53 +0100 Subject: [PATCH] Improved CardCriteria to handle no selected color or card type without exception. --- Mage/src/mage/cards/repository/CardCriteria.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Mage/src/mage/cards/repository/CardCriteria.java b/Mage/src/mage/cards/repository/CardCriteria.java index 11d2d2ac4d..090783bc75 100644 --- a/Mage/src/mage/cards/repository/CardCriteria.java +++ b/Mage/src/mage/cards/repository/CardCriteria.java @@ -256,11 +256,17 @@ public class CardCriteria { where.and(5); colorClauses++; } - where.or(colorClauses); - clausesCount++; + if (colorClauses > 0) { + where.or(colorClauses); + clausesCount++; + } } - where.and(clausesCount); + if (clausesCount > 0) { + where.and(clausesCount); + } else { + where.eq("cardNumber", new SelectArg(0)); + } if (start != null) { qb.offset(start);