Changeset 2425 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2009-11-10T01:49:10+01:00 (14 years ago)
Author:
hansendc
Message:

Fix null pointer exception when removing some nodes

File:
1 edited

Legend:

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

    r2424 r2425  
    241241            return "Way??";
    242242        }
    243         boolean remove_content(T o)
     243        synchronized boolean remove_content(T o)
    244244        {
    245245            boolean ret = this.content.remove(o);
     
    798798            return QuadTiling.tile2LatLon(this.quad);
    799799        }
     800        boolean hasChildren()
     801        {
     802            if (children == null)
     803                return false;
     804
     805            for (QBLevel child : children) {
     806                if (child != null)
     807                    return true;
     808            }
     809            return false;
     810        }
    800811        void remove_from_parent()
    801812        {
     
    810821                if (sibling != this)
    811822                    continue;
    812                 if (this.content != null ||
    813                     this.children != null)
    814                     abort("attempt to remove non-empty child");
     823                if (!canRemove())
     824                    abort("attempt to remove non-empty child: " + this.content + " " + this.children);
    815825                parent.children[i] = null;
    816826                nr_siblings--;
     
    823833            if (content != null && content.size() > 0)
    824834                return false;
    825             if (children != null) {
    826                 for (QBLevel child : children) {
    827                     if (child != null)
    828                         return false;
    829                 }
    830             }
     835            if (this.hasChildren())
     836                return false;
    831837            return true;
    832838        }
Note: See TracChangeset for help on using the changeset viewer.