Changeset 10190 in josm for trunk/src


Ignore:
Timestamp:
2016-05-11T17:10:31+02:00 (9 years ago)
Author:
Don-vip
Message:

fix #12838 - NPE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r10179 r10190  
    6565    }
    6666
    67     private SaveLayersModel model;
     67    private final SaveLayersModel model = new SaveLayersModel();
    6868    private UserAction action = UserAction.CANCEL;
    6969    private final UploadAndSaveProgressRenderer pnlUploadLayers = new UploadAndSaveProgressRenderer();
     
    9494        getContentPane().setLayout(new BorderLayout());
    9595
    96         model = new SaveLayersModel();
    9796        SaveLayersTable table = new SaveLayersTable(model);
    9897        JScrollPane pane = new JScrollPane(table);
     
    411410
    412411        public void redrawIcon() {
    413             try { // Can fail if model is not yet setup properly
    414                 Image base = ((ImageIcon) getValue(BASE_ICON)).getImage();
    415                 BufferedImage newIco = new BufferedImage(ICON_SIZE*3, ICON_SIZE, BufferedImage.TYPE_4BYTE_ABGR);
    416                 Graphics2D g = newIco.createGraphics();
    417                 g.drawImage(model.getLayersToUpload().isEmpty() ? upldDis : upld, ICON_SIZE*0, 0, ICON_SIZE, ICON_SIZE, null);
    418                 g.drawImage(model.getLayersToSave().isEmpty()   ? saveDis : save, ICON_SIZE*1, 0, ICON_SIZE, ICON_SIZE, null);
    419                 g.drawImage(base,                                                 ICON_SIZE*2, 0, ICON_SIZE, ICON_SIZE, null);
    420                 putValue(SMALL_ICON, new ImageIcon(newIco));
    421             } catch (Exception e) {
    422                 Main.warn(e);
    423                 putValue(SMALL_ICON, getValue(BASE_ICON));
    424             }
     412            Image base = ((ImageIcon) getValue(BASE_ICON)).getImage();
     413            BufferedImage newIco = new BufferedImage(ICON_SIZE*3, ICON_SIZE, BufferedImage.TYPE_4BYTE_ABGR);
     414            Graphics2D g = newIco.createGraphics();
     415            g.drawImage(model.getLayersToUpload().isEmpty() ? upldDis : upld, ICON_SIZE*0, 0, ICON_SIZE, ICON_SIZE, null);
     416            g.drawImage(model.getLayersToSave().isEmpty()   ? saveDis : save, ICON_SIZE*1, 0, ICON_SIZE, ICON_SIZE, null);
     417            g.drawImage(base,                                                 ICON_SIZE*2, 0, ICON_SIZE, ICON_SIZE, null);
     418            putValue(SMALL_ICON, new ImageIcon(newIco));
    425419        }
    426420
Note: See TracChangeset for help on using the changeset viewer.