forked from External/mage
DeckEditorPanel - Fixed some existing exceptions.
This commit is contained in:
parent
681cb4b66a
commit
189984d3d6
7 changed files with 127 additions and 114 deletions
|
|
@ -9,6 +9,8 @@ import java.util.Map;
|
|||
import mage.cards.repository.ExpansionInfo;
|
||||
import mage.cards.repository.ExpansionRepository;
|
||||
import mage.constants.SetType;
|
||||
import static mage.constants.SetType.EXPANSION;
|
||||
import static mage.constants.SetType.SUPPLEMENTAL;
|
||||
import mage.deck.Standard;
|
||||
|
||||
/**
|
||||
|
|
@ -64,6 +66,13 @@ public final class ConstructedFormats {
|
|||
underlyingSetCodesPerFormat.put(CUSTOM, new ArrayList<>());
|
||||
final Map<String, ExpansionInfo> expansionInfo = new HashMap<>();
|
||||
formats.clear(); // prevent NPE on sorting if this is not the first try
|
||||
|
||||
// Because this is also called in Netbeans Design view, but the object does not exist in that case,
|
||||
// we have to return here to prevent exception in design view. (Does not hurt at design time)
|
||||
if (!ExpansionRepository.instance.instanceInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ExpansionInfo set : ExpansionRepository.instance.getAll()) {
|
||||
expansionInfo.put(set.getName(), set);
|
||||
formats.add(set.getName());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue