Changeset 2574 in josm for trunk


Ignore:
Timestamp:
2009-12-04T19:11:45+01:00 (12 years ago)
Author:
stoecker
Message:

fix #4085, #4084 - patch by mjulius - fix exception

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r2565 r2574  
    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        }
Note: See TracChangeset for help on using the changeset viewer.