From f6183859819da9379efe0e0903abb67f9d4a0168 Mon Sep 17 00:00:00 2001 From: Michael Abon Date: Tue, 4 Jun 2024 10:45:47 -0500 Subject: [PATCH] Return early from the restriction check loop --- .../mendrelation/PublicTransportMendRelationAction.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/pt_assistant/actions/mendrelation/PublicTransportMendRelationAction.java b/src/main/java/org/openstreetmap/josm/plugins/pt_assistant/actions/mendrelation/PublicTransportMendRelationAction.java index a701a075..e8a794a0 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/pt_assistant/actions/mendrelation/PublicTransportMendRelationAction.java +++ b/src/main/java/org/openstreetmap/josm/plugins/pt_assistant/actions/mendrelation/PublicTransportMendRelationAction.java @@ -1120,18 +1120,17 @@ boolean isRestricted(Way currentWay, Way previousWay, Node commonNode) { else if (rel.hasTag("type", "restriction") && rel.hasKey("restriction")) return false; else { - boolean remove = true; String routeValue = relation.get("route"); for (String s : restrictions) { if (s.length() <= 12) continue; String sub = s.substring(12); if (routeValue.equals(sub) && rel.hasTag("type", s)) - remove = false; + return false; else if (routeValue.equals(sub) && rel.hasKey("restriction:" + sub)) - remove = false; + return false; } - return remove; + return true; } });