mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Prevent some NPE's in the card zoomer
This commit is contained in:
@@ -201,7 +201,7 @@ public enum CardZoomer {
|
||||
* Displays a graphical indicator that shows whether the current card can be flipped or transformed.
|
||||
*/
|
||||
private void setFlipIndicator() {
|
||||
if (thisCard.hasAlternateState()) {
|
||||
if (thisCard != null && thisCard.hasAlternateState()) {
|
||||
imagePanel.setLayout(new MigLayout("insets 0, w 100%!, h 100%!"));
|
||||
imagePanel.add(lblFlipcard, "pos (100% - 100px) 0");
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public enum CardZoomer {
|
||||
private void setImage() {
|
||||
imagePanel = new FImagePanel();
|
||||
|
||||
BufferedImage xlhqImage = FImageUtil.getImageXlhq(getState());
|
||||
final BufferedImage xlhqImage = FImageUtil.getImageXlhq(getState());
|
||||
imagePanel.setImage(xlhqImage == null ? FImageUtil.getImage(getState()) : xlhqImage, getInitialRotation(), AutoSizeImageMode.SOURCE);
|
||||
|
||||
pnlMain.removeAll();
|
||||
@@ -223,7 +223,8 @@ public enum CardZoomer {
|
||||
}
|
||||
|
||||
private int getInitialRotation() {
|
||||
return (thisCard.isSplitCard() || thisCard.getCurrentState().getType().isPlane() || thisCard.getCurrentState().getType().isPhenomenon() ? 90 : 0);
|
||||
return thisCard == null ? 0 :
|
||||
(thisCard.isSplitCard() || thisCard.getCurrentState().getType().isPlane() || thisCard.getCurrentState().getType().isPhenomenon() ? 90 : 0);
|
||||
}
|
||||
|
||||
private void setLayout() {
|
||||
@@ -279,7 +280,7 @@ public enum CardZoomer {
|
||||
* Toggles between primary and alternate image associated with card if applicable.
|
||||
*/
|
||||
private void toggleCardImage() {
|
||||
if (thisCard.hasAlternateState()) {
|
||||
if (thisCard != null && thisCard.hasAlternateState()) {
|
||||
toggleFlipCard();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user