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