Index: trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 19670)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java	(revision 19671)
@@ -405,6 +405,11 @@
      */
     void visit(Collection<OsmPrimitive> selection, Predicate<String> urlPredicate) {
+        // the rules may be reloaded by another thread (preferences, file watcher) while the validation is running, see #22878
+        final List<Entry<String, Set<MapCSSTagCheckerRule>>> checksToRun;
+        synchronized (this) {
+            checksToRun = new ArrayList<>(checks.entrySet());
+        }
         if (urlPredicate == null && progressMonitor != null) {
-            progressMonitor.setTicksCount(selection.size() * checks.size());
+            progressMonitor.setTicksCount(selection.size() * checksToRun.size());
         }
 
@@ -414,5 +419,5 @@
 
         Set<OsmPrimitive> surrounding = new HashSet<>();
-        for (Entry<String, Set<MapCSSTagCheckerRule>> entry : checks.entrySet()) {
+        for (Entry<String, Set<MapCSSTagCheckerRule>> entry : checksToRun) {
             if (isCanceled()) {
                 break;
