forked from External/mage
Fixed some possible null pointer exceptions.
This commit is contained in:
parent
663c6fe1e9
commit
7e9d285a49
4 changed files with 28 additions and 16 deletions
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
|
|
@ -20,12 +20,11 @@
|
|||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.game.draft;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -69,12 +68,12 @@ public class DraftPlayer {
|
|||
public void prepareDeck() {
|
||||
if (!hiddenCards.isEmpty()) {
|
||||
Set<Card> cardsToDeck = new HashSet<>();
|
||||
for(Card card: deck.getSideboard()) {
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (!hiddenCards.contains(card.getId())) {
|
||||
cardsToDeck.add(card);
|
||||
}
|
||||
}
|
||||
for(Card card: cardsToDeck) {
|
||||
for (Card card : cardsToDeck) {
|
||||
deck.getSideboard().remove(card);
|
||||
deck.getCards().add(card);
|
||||
}
|
||||
|
|
@ -90,7 +89,7 @@ public class DraftPlayer {
|
|||
if (hiddenCards != null) {
|
||||
this.hiddenCards = hiddenCards;
|
||||
}
|
||||
synchronized(booster) {
|
||||
synchronized (booster) {
|
||||
booster.remove(card);
|
||||
}
|
||||
picking = false;
|
||||
|
|
@ -101,13 +100,15 @@ public class DraftPlayer {
|
|||
// booster = set.createBooster();
|
||||
// }
|
||||
// }
|
||||
|
||||
public void setBooster(List<Card> booster) {
|
||||
this.booster = booster;
|
||||
}
|
||||
|
||||
public List<Card> getBooster() {
|
||||
synchronized(booster) {
|
||||
if (booster == null) {
|
||||
return null;
|
||||
}
|
||||
synchronized (booster) {
|
||||
return new ArrayList<>(booster);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue