Fixed possible null pointer exception.

This commit is contained in:
LevelX2 2015-01-30 21:10:54 +01:00
parent e74c10289e
commit d69edc00c7
2 changed files with 7 additions and 5 deletions

View file

@ -94,7 +94,7 @@ class MarduWoeReaperTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getPlayerId().equals(this.getControllerId())) { if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getPlayerId().equals(this.getControllerId())) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && (permanent.getId() == this.getSourceId() || permanent.getSubtype().contains("Warrior"))) { if (permanent != null && (permanent.getId() == this.getSourceId() || permanent.hasSubtype("Warrior"))) {
return true; return true;
} }
} }
@ -103,7 +103,7 @@ class MarduWoeReaperTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public String getRule() { public String getRule() {
return "Whenever {this} or another Warrior enters the battlefield under your control, you may exile target creature card from a graveyard. If you do, you gain 1 life."; return "Whenever {this} or another Warrior enters the battlefield under your control, " + super.getRule();
} }
} }
@ -111,7 +111,7 @@ class MarduWoeReaperEffect extends OneShotEffect {
MarduWoeReaperEffect() { MarduWoeReaperEffect() {
super(Outcome.GainLife); super(Outcome.GainLife);
this.staticText = "Exile target creature card from a graveyard. If you do, you gain 1 life"; this.staticText = "you may exile target creature card from a graveyard. If you do, you gain 1 life";
} }
MarduWoeReaperEffect(final MarduWoeReaperEffect effect) { MarduWoeReaperEffect(final MarduWoeReaperEffect effect) {

View file

@ -304,8 +304,10 @@ public enum CardRepository {
public void closeDB() { public void closeDB() {
try { try {
DatabaseConnection conn = cardDao.getConnectionSource().getReadWriteConnection(); if (cardDao != null && cardDao.getConnectionSource() != null) {
conn.executeStatement("shutdown compact", 0); DatabaseConnection conn = cardDao.getConnectionSource().getReadWriteConnection();
conn.executeStatement("shutdown compact", 0);
}
} catch (SQLException ex) { } catch (SQLException ex) {