Ignore:
Timestamp:
2007-09-02T20:26:53+02:00 (17 years ago)
Author:
ulf
Message:

don't throw a NullPointerException, if an icon png wasn't found - put a warning on the console instead

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mappaint/src/mappaint/ElemStyleHandler.java

    r3638 r4417  
    114114                                                                                                        try {
    115115                                                                                                                URL path = getClass().getResource("/standard/icons/"+atts.getValue(count));
    116                                                                                                                 curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
     116                                                                                                                if(path == null) {
     117                                                                                                                        /* icon not found, using default */
     118                                                                                                                        System.out.println("Mappaint: Icon " + atts.getValue(count) + " not found, using default icon");
     119                                                                                                                        path = getClass().getResource("/standard/icons/misc/no_icon.png");
     120                                                                                                                        curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
     121                                                                                                                } else {
     122                                                                                                                        curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
     123                                                                                                                }
    117124                                                                                                        }
    118125                                                                                                        catch (Exception e){
    119126                                                                                                                URL path = getClass().getResource("/standard/icons/amenity.png");
    120127                                                                                                                curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path));
    121 
    122128                                                                                                        }
    123129                                                                                                }
Note: See TracChangeset for help on using the changeset viewer.