Ticket #20163: 20163.patch

File 20163.patch, 1.7 KB (added by GerdP, 3 years ago)

fix and unit test, seems to fix 10808 as well

  • src/org/openstreetmap/josm/command/SplitWayCommand.java

     
    466466                        RelationInformation rValue = treatAsRestriction(r, rm, c, newWays, way, changedWayNodes);
    467467                        if (rValue.warnme) warnings.add(WarningType.GENERIC);
    468468                        insert = rValue.insert;
    469                         c = rValue.relation;
     469                        c = rValue.relation; // Value.relation is null or contains a modified copy
    470470                    } else if (!isOrderedRelation) {
    471471                        // Warn the user when relations that are not a route or multipolygon are modified as a result
    472472                        // of splitting up the way, because we can't tell if this might break anything.
    473473                        warnings.add(WarningType.GENERIC);
    474474                    }
    475                     if (c == null) {
    476                         c = new Relation(r);
    477                     }
    478475
    479476                    if (insert) {
     477                        if (c == null) {
     478                            c = new Relation(r);
     479                        }
    480480                        if (rm.hasRole() && !nowarnroles.contains(rm.getRole())) {
    481481                            warnings.add(WarningType.ROLE);
    482482                        }
     
    824824            }
    825825        } else if (!"via".equals(role)) {
    826826            relationInformation.warnme = true;
     827        } else {
     828            relationInformation.insert = true;
    827829        }
    828830        relationInformation.relation = c;
    829831        return relationInformation;