Ticket #4085: DeleteCommandException.patch

File DeleteCommandException.patch, 1.5 KB (added by mjulius, 15 years ago)
  • src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

     
    887887        // Method copied from OsmPrimitive in josm-ng
    888888        // Returns only referrers that are members of the same dataset (primitive can have some fake references, for example
    889889        // when way is cloned
    890         if (referrers == null)
    891             return Collections.emptyList();
    892 
    893         if (referrers instanceof OsmPrimitive) {
    894             if (((OsmPrimitive)referrers).dataSet == dataSet)
    895                 return Collections.singletonList((OsmPrimitive)referrers);
    896             else
    897                 return Collections.emptyList();
    898         }
    899 
    900890        List<OsmPrimitive> result = new ArrayList<OsmPrimitive>();
    901         for (OsmPrimitive o:(OsmPrimitive[])referrers) {
    902             if (dataSet == o.dataSet) {
    903                 result.add(o);
     891        if (referrers != null) {
     892            if ((referrers instanceof OsmPrimitive) && (((OsmPrimitive)referrers).dataSet == dataSet)) {
     893                result.add((OsmPrimitive)referrers);
     894            } else {
     895                for (OsmPrimitive o:(OsmPrimitive[])referrers) {
     896                    if (dataSet == o.dataSet) {
     897                        result.add(o);
     898                    }
     899                }
    904900            }
    905901        }
    906902