From 4de9d4616b988f08dabbd867a82e12d38b34c052 Mon Sep 17 00:00:00 2001 From: melvin Date: Fri, 11 Nov 2011 10:56:00 +0800 Subject: [PATCH] MagicCardDefinition.add throws RuntimeException ifi null is passed --- src/magic/model/MagicCardDefinition.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/magic/model/MagicCardDefinition.java b/src/magic/model/MagicCardDefinition.java index 9cfd021d5d..b7e54b2da7 100644 --- a/src/magic/model/MagicCardDefinition.java +++ b/src/magic/model/MagicCardDefinition.java @@ -256,7 +256,9 @@ public class MagicCardDefinition { } public void add(final Object obj) { - if (obj instanceof MagicSpellCardEvent) { + if (obj == null) { + throw new RuntimeException("MagicCardDefinition.add passed null"); + } else if (obj instanceof MagicSpellCardEvent) { final MagicSpellCardEvent cevent = (MagicSpellCardEvent)obj; setCardEvent(cevent); cevent.setCardIndex(index);