mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
update potential NPE on CardView
This commit is contained in:
@@ -832,7 +832,13 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GuiBase.getInterface().isLibgdxPort()) {
|
if (GuiBase.getInterface().isLibgdxPort()) {
|
||||||
return this.getGui().confirm(wrapper.getView().getHostCard(), buildQuestion.toString().replaceAll("\n", " "));
|
CardView cardView;
|
||||||
|
SpellAbilityView spellAbilityView = wrapper.getView();
|
||||||
|
if (spellAbilityView != null) //updated view
|
||||||
|
cardView = spellAbilityView.getHostCard();
|
||||||
|
else
|
||||||
|
cardView = wrapper.getCardView();
|
||||||
|
return this.getGui().confirm(cardView, buildQuestion.toString().replaceAll("\n", " "));
|
||||||
} else {
|
} else {
|
||||||
final InputConfirm inp = new InputConfirm(this, buildQuestion.toString(), wrapper);
|
final InputConfirm inp = new InputConfirm(this, buildQuestion.toString(), wrapper);
|
||||||
inp.showAndWait();
|
inp.showAndWait();
|
||||||
@@ -1432,8 +1438,9 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
GameEntity affected, final String question) {
|
GameEntity affected, final String question) {
|
||||||
if (GuiBase.getInterface().isLibgdxPort()) {
|
if (GuiBase.getInterface().isLibgdxPort()) {
|
||||||
CardView cardView;
|
CardView cardView;
|
||||||
if (effectSA.getView() != null) //updated view
|
SpellAbilityView spellAbilityView = effectSA.getView();
|
||||||
cardView = effectSA.getView().getHostCard();
|
if (spellAbilityView != null) //updated view
|
||||||
|
cardView = spellAbilityView.getHostCard();
|
||||||
else //fallback
|
else //fallback
|
||||||
cardView = effectSA.getCardView();
|
cardView = effectSA.getCardView();
|
||||||
return this.getGui().confirm(cardView, question.replaceAll("\n", " "));
|
return this.getGui().confirm(cardView, question.replaceAll("\n", " "));
|
||||||
@@ -1866,7 +1873,11 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
try {
|
try {
|
||||||
cardView = CardView.getCardForUi(ImageUtil.getPaperCardFromImageKey(sa.getView().getHostCard().getCurrentState().getTrackableImageKey()));
|
cardView = CardView.getCardForUi(ImageUtil.getPaperCardFromImageKey(sa.getView().getHostCard().getCurrentState().getTrackableImageKey()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
cardView = sa.getView().getHostCard();
|
SpellAbilityView spellAbilityView = sa.getView();
|
||||||
|
if (spellAbilityView != null) //updated view
|
||||||
|
cardView = spellAbilityView.getHostCard();
|
||||||
|
else //fallback
|
||||||
|
cardView = sa.getCardView();
|
||||||
}
|
}
|
||||||
return this.getGui().confirm(cardView, question.replaceAll("\n", " "));
|
return this.getGui().confirm(cardView, question.replaceAll("\n", " "));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user