mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-12 08:48:39 +00:00
prevent NPE
This commit is contained in:
@@ -243,7 +243,7 @@ public class CardImageRenderer {
|
||||
float padding = h / 8;
|
||||
float manaCostWidth = 0;
|
||||
float manaSymbolSize = isAdventure ? MANA_SYMBOL_SIZE * 0.75f : MANA_SYMBOL_SIZE;
|
||||
if (!noText) {
|
||||
if (!noText && state != null) {
|
||||
//draw mana cost for card
|
||||
ManaCost mainManaCost = state.getManaCost();
|
||||
if (card.isSplitCard() && card.getAlternateState() != null) {
|
||||
@@ -263,7 +263,7 @@ public class CardImageRenderer {
|
||||
//draw name for card
|
||||
x += padding;
|
||||
w -= 2 * padding;
|
||||
if (!noText)
|
||||
if (!noText && state != null)
|
||||
g.drawText(CardTranslation.getTranslatedName(state.getName()), NAME_FONT, Color.BLACK, x, y, w - manaCostWidth - padding, h, false, Align.left, true);
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ public class CardImageRenderer {
|
||||
float padding = h / 8;
|
||||
|
||||
//draw square icon for rarity
|
||||
if (!noRarity) {
|
||||
if (!noRarity && state != null) {
|
||||
float iconSize = h * 0.9f;
|
||||
float iconPadding = (h - iconSize) / 2;
|
||||
w -= iconSize + iconPadding * 2;
|
||||
@@ -439,7 +439,8 @@ public class CardImageRenderer {
|
||||
if (noText)
|
||||
return;
|
||||
x += padding;
|
||||
g.drawText(CardDetailUtil.formatCardType(state, canShow), TYPE_FONT, Color.BLACK, x, y, w, h, false, Align.left, true);
|
||||
if (state != null)
|
||||
g.drawText(CardDetailUtil.formatCardType(state, canShow), TYPE_FONT, Color.BLACK, x, y, w, h, false, Align.left, true);
|
||||
}
|
||||
|
||||
//use text renderer to handle mana symbols and reminder text
|
||||
|
||||
Reference in New Issue
Block a user