Index: trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java	(revision 15356)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java	(revision 15357)
@@ -24,4 +24,5 @@
 import java.util.Set;
 import java.util.function.BiConsumer;
+import java.util.function.Consumer;
 import java.util.function.Function;
 
@@ -348,6 +349,10 @@
                 // Only process complete (final) selection events
                 for (int i = e.getFirstIndex(); i <= e.getLastIndex(); i++) {
-                    updateBoundsAndShapes(defaultTable.convertRowIndexToModel(i));
-                }
+                    if (i < defaultTable.getRowCount()) {
+                        updateBoundsAndShapes(defaultTable.convertRowIndexToModel(i));
+                    }
+                }
+                // Cleanup residual selected bounds which may have disappeared after a filter
+                cleanupResidualBounds();
                 // If needed, adjust map to show all map rectangles and polygons
                 if (!mapRectangles.isEmpty() || !mapPolygons.isEmpty()) {
@@ -405,4 +410,18 @@
             }
         }
+
+        private <T> void doCleanupResidualBounds(Map<Integer, T> map, Consumer<T> removalEffect) {
+            for (Integer i : map.keySet()) {
+                int viewIndex = defaultTable.convertRowIndexToView(i);
+                if (!defaultTable.getSelectionModel().isSelectedIndex(viewIndex)) {
+                    removalEffect.accept(map.remove(i));
+                }
+            }
+        }
+
+        private void cleanupResidualBounds() {
+            doCleanupResidualBounds(mapPolygons, l -> l.forEach(defaultMap::removeMapPolygon));
+            doCleanupResidualBounds(mapRectangles, defaultMap::removeMapRectangle);
+        }
     }
 
