Changeset 21433 in osm


Ignore:
Timestamp:
2010-05-24T17:52:53+02:00 (14 years ago)
Author:
stoecker
Message:

fix exception when data loading fails, add rel shortcut for selection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RequestProcessor.java

    r19946 r21433  
    196196                                } else if (item.startsWith("relation")) {
    197197                                    relations.add(Long.parseLong(item.substring(8)));
     198                                } else if (item.startsWith("rel")) {
     199                                    relations.add(Long.parseLong(item.substring(3)));
    198200                                } else {
    199201                                    System.out.println("RemoteControl: invalid selection '"+item+"' ignored");
    200202                                }
    201203                            }
    202                             for (Way w : Main.main.getCurrentDataSet().getWays()) if (ways.contains(w.getId())) newSel.add(w);
    203                             for (Node n : Main.main.getCurrentDataSet().getNodes()) if (nodes.contains(n.getId())) newSel.add(n);
    204                             for (Relation r : Main.main.getCurrentDataSet().getRelations()) if (relations.contains(r.getId())) newSel.add(r);
    205                             Main.main.getCurrentDataSet().setSelected(newSel);
     204                            DataSet ds = Main.main.getCurrentDataSet();
     205                            if(ds == null) // e.g. download failed
     206                                return;
     207                            for (Way w : ds.getWays()) if (ways.contains(w.getId())) newSel.add(w);
     208                            for (Node n : ds.getNodes()) if (nodes.contains(n.getId())) newSel.add(n);
     209                            for (Relation r : ds.getRelations()) if (relations.contains(r.getId())) newSel.add(r);
     210                            ds.setSelected(newSel);
    206211                            if (Main.pref.getBoolean("remotecontrol.permission.change-viewport", true))
    207212                                new AutoScaleAction("selection").actionPerformed(null);
Note: See TracChangeset for help on using the changeset viewer.