Skip to content

Commit

Permalink
Merge pull request vassalengine#12886 from riverwanderer/suppress-pie…
Browse files Browse the repository at this point in the history
…ce-pallettes-boolean-errors

Suppress piece palette boolean bad data errors
  • Loading branch information
uckelman authored Dec 7, 2023
2 parents fb06626 + 0509721 commit f8b19b0
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import VASSAL.build.BadDataReport;
import VASSAL.build.module.properties.PropertySource;
import VASSAL.counters.EditablePiece;
import VASSAL.counters.GamePiece;
import VASSAL.counters.PieceFilter;
import VASSAL.i18n.Resources;
Expand All @@ -15,7 +16,7 @@

/*
* Class encapsulating a Property Match Expression
* A PropertyExpression is it's own PieceFilter.
* A PropertyExpression is its own PieceFilter.
*/
public class PropertyExpression implements PieceFilter {

Expand Down Expand Up @@ -120,7 +121,9 @@ public boolean isTrue(PropertySource ps, Auditable owner, AuditTrail audit) {
result = expression.evaluate(ps, owner, audit);
}
catch (ExpressionException e) {
ErrorDialog.dataWarning(new BadDataReport(Resources.getString("Error.expression_error"),
// suppress error report if this is an editable piece on the Piece Palette (where boolean calcs are not supported)
if (!(owner instanceof EditablePiece) || ((EditablePiece) owner).getMap() != null)
ErrorDialog.dataWarning(new BadDataReport(Resources.getString("Error.expression_error"),
"Expression=" + getExpression() + ", Error=" + e.getError(), e)); //NON-NLS
}
return "true".equals(result); //NON-NLS
Expand Down

0 comments on commit f8b19b0

Please sign in to comment.