Ignore:
Timestamp:
2012-07-28T14:40:33+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #7909 - NPE upon selection of "file" -> "load object"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java

    r5354 r5372  
    318318    private void tryToPasteFromClipboard(OsmIdTextField tfId, OsmPrimitiveTypesComboBox cbType) {
    319319        String buf = Utils.getClipboardContent();
    320         if (buf.contains("node")) cbType.setSelectedIndex(0);
    321         if (buf.contains("way")) cbType.setSelectedIndex(1);
    322         if (buf.contains("relation")) cbType.setSelectedIndex(2);
    323         String[] res = buf.split("/");
    324         String txt;
    325         if (res.length>0) {
    326             txt = res[res.length-1];
    327             if (txt.isEmpty() && txt.length()>1) txt=res[res.length-2];
    328         } else {
    329             txt=buf;
    330         }
    331         tfId.setText(txt);
    332         tfId.clearTextIfInvalid();
     320        if (buf != null) {
     321                if (buf.contains("node")) cbType.setSelectedIndex(0);
     322                if (buf.contains("way")) cbType.setSelectedIndex(1);
     323                if (buf.contains("relation")) cbType.setSelectedIndex(2);
     324                String[] res = buf.split("/");
     325                String txt;
     326                if (res.length>0) {
     327                    txt = res[res.length-1];
     328                    if (txt.isEmpty() && txt.length()>1) txt=res[res.length-2];
     329                } else {
     330                    txt=buf;
     331                }
     332                tfId.setText(txt);
     333                tfId.clearTextIfInvalid();
     334        }
    333335    }
    334336}
Note: See TracChangeset for help on using the changeset viewer.