diff --git a/vassal-app/src/main/java/VASSAL/build/module/map/CounterDetailViewer.java b/vassal-app/src/main/java/VASSAL/build/module/map/CounterDetailViewer.java index a977e4f18f..ad8cb8107c 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/map/CounterDetailViewer.java +++ b/vassal-app/src/main/java/VASSAL/build/module/map/CounterDetailViewer.java @@ -628,6 +628,14 @@ public Filter() { topLayer = -1; } + public boolean checkFilter(GamePiece piece) { + final String s = propertyFilter.getExpression().trim(); + if (s.isEmpty()) { + return true; + } + return propertyFilter.accept(piece); + } + @Override public boolean accept(GamePiece piece) { return accept(piece, 0, ""); @@ -664,7 +672,7 @@ public boolean accept(GamePiece piece, int layer, String layerName) { // Looking at All Layers accepts anything. else if (displayWhat.equals(ALL_LAYERS)) { - return propertyFilter.accept(piece); + return checkFilter(piece); } else { @@ -674,14 +682,14 @@ else if (displayWhat.equals(ALL_LAYERS)) { // Pieces are passed to us top down, so only display the top-most layer if (displayWhat.equals(TOP_LAYER)) { - return (layer == topLayer) && propertyFilter.accept(piece); + return (layer == topLayer) && checkFilter(piece); } // Include pieces on named layers only else if (displayWhat.equals(INC_LAYERS)) { for (final String displayLayer : displayLayers) { if (layerName.equals(displayLayer)) { - return propertyFilter.accept(piece); + return checkFilter(piece); } } } @@ -693,7 +701,7 @@ else if (displayWhat.equals(EXC_LAYERS)) { return false; } } - return propertyFilter.accept(piece); + return checkFilter(piece); } }