Changeset 4725 in josm


Ignore:
Timestamp:
Dec 27, 2011 5:30:32 PM (17 months ago)
Author:
jttt
Message:

Fix #7074 Crash after purging some data

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

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

    r4684 r4725  
    819819     * <code>Way wnew = new Way(existingWay)</code> 
    820820     * 
     821     * @param allowWithoutDataset If true, method will return empty list if primitive is not part of the dataset. If false, 
     822     * exception will be thrown in this case 
     823     * 
    821824     * @return a collection of all primitives that reference this primitive. 
    822825     */ 
    823826 
    824     public final List<OsmPrimitive> getReferrers() { 
     827    public final List<OsmPrimitive> getReferrers(boolean allowWithoutDataset) { 
    825828        // Method copied from OsmPrimitive in josm-ng 
    826829        // Returns only referrers that are members of the same dataset (primitive can have some fake references, for example 
    827830        // when way is cloned 
     831 
     832        if (dataSet == null && allowWithoutDataset) 
     833            return Collections.emptyList(); 
     834 
    828835        checkDataset(); 
    829836        Object referrers = this.referrers; 
     
    846853    } 
    847854 
     855    public final List<OsmPrimitive> getReferrers() { 
     856        return getReferrers(false); 
     857    } 
     858 
    848859    /** 
    849860     * <p>Visits {@code visitor} for all referrers.</p> 
     
    966977        if (!isNew() &&  id != other.id) 
    967978            return false; 
    968 //        if (isIncomplete() && ! other.isIncomplete() || !isIncomplete()  && other.isIncomplete()) 
     979        //        if (isIncomplete() && ! other.isIncomplete() || !isIncomplete()  && other.isIncomplete()) 
    969980        if (isIncomplete() ^ other.isIncomplete()) // exclusive or operator for performance (see #7159) 
    970981            return false; 
  • trunk/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java

    r4724 r4725  
    6868            List<OsmPrimitive> result = new ArrayList<OsmPrimitive>(); 
    6969            for (OsmPrimitive child: children) { 
    70                 for (OsmPrimitive parent: child.getReferrers()) { 
     70                for (OsmPrimitive parent: child.getReferrers(true)) { 
    7171                    if (condition == null || condition.match(parent)) { 
    7272                        result.add(parent); 
Note: See TracChangeset for help on using the changeset viewer.