update NPE prevention

This commit is contained in:
Anthony Calosa
2024-11-03 12:14:43 +08:00
parent 4a1bbdc3ba
commit 74f9d05b08
2 changed files with 15 additions and 10 deletions

View File

@@ -66,12 +66,11 @@ public class VZoneDisplay extends VCardDisplayArea {
}
private void setRevealedPanel(int idx) {
try {
revealedPanel = cardPanels().get(idx); //on network match, when zoomed and cast a card would randomly trigger the bug
} catch (Exception e) { //before it was arrayindexoutofbounds, then indexoutofbounds, so just use a general exception
//e.printStackTrace();
if (idx >= 0 && idx < cardPanels().size())
revealedPanel = cardPanels().get(idx);
else
return;
}
clearChildren();
if (Forge.isLandscapeMode()) {
//for landscape mode, just show revealed card on top