mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
update NPE prevention
This commit is contained in:
@@ -78,13 +78,19 @@ public class CCombat implements ICDoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
display.append("\n");
|
display.append("\n");
|
||||||
|
PlayerView controller = null;
|
||||||
if (defender instanceof CardView) {
|
if (defender instanceof CardView) {
|
||||||
final PlayerView controller = ((CardView) defender).getController();
|
controller = ((CardView) defender).getController();
|
||||||
display.append(Lang.getInstance().getPossesive(controller.getName())).append(" ");
|
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
|
||||||
|
display.append(Lang.getInstance().getPossesive(controller.getName())).append(" ");
|
||||||
}
|
}
|
||||||
|
if (controller == null)
|
||||||
display.append(defender).append(" is attacked by:\n");
|
display.append(" is attacked by:\n");
|
||||||
|
else
|
||||||
|
display.append(defender).append(" is attacked by:\n");
|
||||||
|
|
||||||
// Associate Bands, Attackers Blockers
|
// Associate Bands, Attackers Blockers
|
||||||
boolean previousBand = false;
|
boolean previousBand = false;
|
||||||
|
|||||||
@@ -66,12 +66,11 @@ public class VZoneDisplay extends VCardDisplayArea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setRevealedPanel(int idx) {
|
private void setRevealedPanel(int idx) {
|
||||||
try {
|
if (idx >= 0 && idx < cardPanels().size())
|
||||||
revealedPanel = cardPanels().get(idx); //on network match, when zoomed and cast a card would randomly trigger the bug
|
revealedPanel = cardPanels().get(idx);
|
||||||
} catch (Exception e) { //before it was arrayindexoutofbounds, then indexoutofbounds, so just use a general exception
|
else
|
||||||
//e.printStackTrace();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
clearChildren();
|
clearChildren();
|
||||||
if (Forge.isLandscapeMode()) {
|
if (Forge.isLandscapeMode()) {
|
||||||
//for landscape mode, just show revealed card on top
|
//for landscape mode, just show revealed card on top
|
||||||
|
|||||||
Reference in New Issue
Block a user