mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
This list doesn't need to be instantiated like an array
This commit is contained in:
@@ -593,7 +593,7 @@ public class Game {
|
||||
}
|
||||
|
||||
public Zone getZoneOf(final Card card) {
|
||||
return card.getLastKnownZone();
|
||||
return card == null ? null : card.getLastKnownZone();
|
||||
}
|
||||
|
||||
public synchronized CardCollectionView getCardsIn(final ZoneType zone) {
|
||||
|
||||
@@ -291,7 +291,7 @@ public final class SRearrangingUtil {
|
||||
}
|
||||
|
||||
// Remove old cell if necessary, or, enforce rough bounds on new cell.
|
||||
if (cellSrc.getDocs().size() == 0) {
|
||||
if (cellSrc.getDocs().isEmpty()) {
|
||||
fillGap();
|
||||
FView.SINGLETON_INSTANCE.removeDragCell(cellSrc);
|
||||
}
|
||||
|
||||
@@ -184,6 +184,10 @@ public enum CDeckEditorUI implements ICDoc {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addSelectedCards(final boolean toAlternate, final int number) {
|
||||
if (childController == null || childController.getCatalogManager() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
moveSelectedItems(childController.getCatalogManager(), new _MoveAction() {
|
||||
@Override public <T extends InventoryItem> void move(final Iterable<Entry<T, Integer>> items) {
|
||||
((ACEditorBase<T, ?>)childController).addItems(items, toAlternate);
|
||||
|
||||
@@ -79,13 +79,14 @@ public class CCombat implements ICDoc {
|
||||
display.append("\n");
|
||||
if (defender instanceof CardView) {
|
||||
PlayerView controller = ((CardView) defender).getController();
|
||||
if (controller == null)
|
||||
if (controller == null) {
|
||||
//shouldn't be null but display card's + controller ie Black Knight's controller
|
||||
display.append(Lang.getInstance().getPossesive(defender.getName())).append(" controller");
|
||||
else
|
||||
} else {
|
||||
display.append(Lang.getInstance().getPossesive(controller.getName())).append(" ");
|
||||
}
|
||||
}
|
||||
display.append(defender).append(" is attacked by:\n");
|
||||
display.append(defender).append(" is attacked by:\n`");
|
||||
|
||||
// Associate Bands, Attackers Blockers
|
||||
boolean previousBand = false;
|
||||
|
||||
@@ -104,10 +104,9 @@ public class VCombat implements IVDoc<CCombat> {
|
||||
|
||||
//========= Observer update methods
|
||||
|
||||
/** @param s0   {@link java.lang.String} */
|
||||
public void updateCombat(final int cntAttackers, final String desc) {
|
||||
// No need to update this unless it's showing
|
||||
if (!this.equals(parentCell.getSelected())) { return; }
|
||||
if (parentCell == null || !this.equals(parentCell.getSelected())) { return; }
|
||||
|
||||
tab.setText(cntAttackers > 0 ? (Localizer.getInstance().getMessage("lblCombatTab") + " : " + cntAttackers) : Localizer.getInstance().getMessage("lblCombatTab"));
|
||||
tar.setText(desc);
|
||||
|
||||
@@ -135,7 +135,7 @@ public class VLog implements IVDoc<CLog> {
|
||||
}
|
||||
|
||||
private boolean isGameLogConsoleVisible() {
|
||||
return parentCell.getSelected().equals(this);
|
||||
return parentCell != null && parentCell.getSelected().equals(this);
|
||||
}
|
||||
|
||||
private void resetDisplayIfNewGame(final GameView model) {
|
||||
|
||||
@@ -123,7 +123,7 @@ public class VStack implements IVDoc<CStack> {
|
||||
tab.setText(Localizer.getInstance().getMessage("lblStack") + " : " + items.size());
|
||||
|
||||
// No need to update the rest unless it's showing
|
||||
if (!parentCell.getSelected().equals(this)) { return; }
|
||||
if (parentCell == null || !parentCell.getSelected().equals(this)) { return; }
|
||||
|
||||
hoveredItem = null;
|
||||
scroller.removeAll();
|
||||
|
||||
@@ -278,7 +278,7 @@ public abstract class CardPanelContainer extends SkinnedPanel {
|
||||
|
||||
public final CardPanel getCardPanel(final int gameCardID) {
|
||||
for (final CardPanel panel : this.getCardPanels()) {
|
||||
if (panel.getCard().getId() == gameCardID) {
|
||||
if (panel.getCard() != null && panel.getCard().getId() == gameCardID) {
|
||||
return panel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user