Ignore:
Timestamp:
2008-11-14T01:25:22+01:00 (16 years ago)
Author:
frederik
Message:

bugfix lakewalker NPE by Stephan <osm@…>

Location:
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java

    r10920 r11920  
    176176        System.out.println("After removing duplicate nodes, "+nodelist.size()+" nodes remain.");
    177177         
     178       
     179        // if for some reason (image loading failed, ...) nodelist is empty, no more processing required.
     180        if (nodelist.size() == 0) {
     181                return;
     182        }
    178183       
    179184        /**
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java

    r6953 r11920  
    123123                        // Read from a URL
    124124                        URL url = new URL(urlloc);
    125                         this.image = ImageIO.read(url);
     125                        this.image = ImageIO.read(url); // this can return null!
    126126                } catch(MalformedURLException e){
    127127                        System.out.println(e.getMessage());
     
    132132                    }
    133133               
    134                 this.images.add(this.image);
    135                 this.imageindex.put(hashkey,this.images.size()-1);
    136                
    137                 this.saveimage(file,this.image);
     134                if (this.image != null) {
     135                        this.images.add(this.image);
     136                        this.imageindex.put(hashkey,this.images.size()-1);
     137                       
     138                        this.saveimage(file,this.image);
     139                }
    138140            }
    139141           
Note: See TracChangeset for help on using the changeset viewer.