* Fixed a problem with index out of bound for card renderer.
*/
package org.mage.card.arcane;
-import mage.ObjectColor;
-import mage.cards.ArtRect;
-import mage.cards.FrameStyle;
-import mage.client.dialog.PreferencesDialog;
-import mage.constants.CardType;
-import mage.constants.MageObjectType;
-import mage.constants.SubType;
-import mage.util.SubTypeList;
-import mage.view.CardView;
-import mage.view.PermanentView;
-import org.apache.log4j.Logger;
-
-import javax.swing.*;
import java.awt.*;
import java.awt.font.*;
import java.awt.geom.Rectangle2D;
@@ -31,6 +18,18 @@ import java.text.CharacterIterator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import javax.swing.*;
+import mage.ObjectColor;
+import mage.cards.ArtRect;
+import mage.cards.FrameStyle;
+import mage.client.dialog.PreferencesDialog;
+import mage.constants.CardType;
+import mage.constants.MageObjectType;
+import mage.constants.SubType;
+import mage.util.SubTypeList;
+import mage.view.CardView;
+import mage.view.PermanentView;
+import org.apache.log4j.Logger;
/*
@@ -849,6 +848,9 @@ public class ModernCardRenderer extends CardRenderer {
inset = cardWidth / 12;
}
int availWidth = w - inset;
+ if (availWidth < 0) {
+ return 0;
+ }
FontRenderContext frc = g.getFontRenderContext();
AttributedCharacterIterator textIter = text.getIterator();
