* Non creature tokens - fixed rollback errors in AI games (example: Food token, see #6331);

Fixed other potentially NPE errors with rarity;
This commit is contained in:
Oleg Agafonov 2020-03-06 03:27:46 +04:00
parent 1b60dfc258
commit cb8d4dc340
12 changed files with 88 additions and 70 deletions

View file

@ -97,8 +97,8 @@ public class MageCardComparator implements Comparator<CardView> {
break;
// Rarity
case 6:
aCom = a.getRarity().getSorting();
bCom = b.getRarity().getSorting();
aCom = a.getRarity() == null ? 0 : a.getRarity().getSorting();
bCom = b.getRarity() == null ? 0 : b.getRarity().getSorting();
break;
// Set name
case 7:

View file

@ -6,8 +6,8 @@ import mage.client.cards.CardEventSource;
import mage.client.cards.ICardGrid;
import mage.client.deckeditor.SortSetting;
import mage.client.plugins.impl.Plugins;
import mage.client.util.ClientEventType;
import mage.client.util.ClientDefaultSettings;
import mage.client.util.ClientEventType;
import mage.client.util.Event;
import mage.client.util.Listener;
import mage.client.util.gui.GuiDisplayUtil;
@ -235,7 +235,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
return c.isCreature() ? c.getPower() + '/'
+ c.getToughness() : "-";
case 6:
return c.getRarity().toString();
return c.getRarity() == null ? "" : c.getRarity().toString();
case 7:
return c.getExpansionSetCode();
case 8: