Ignore:
Timestamp:
2013-09-18T21:26:49+02:00 (11 years ago)
Author:
donvip
Message:

[josm_namemanager] fix #josm9073 - NPE

Location:
applications/editors/josm/plugins/namemanager
Files:
2 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/namemanager/.classpath

    r25571 r29930  
    33        <classpathentry kind="src" path="src"/>
    44        <classpathentry kind="src" path="resources"/>
    5         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
     5        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
    66        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
    77        <classpathentry kind="output" path="bin"/>
  • applications/editors/josm/plugins/namemanager/src/org/openstreetmap/josm/plugins/namemanager/listeners/NameManagerAction.java

    r29778 r29930  
    7070    @Override
    7171    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    72         setEnabled(newSelection != null
    73                 && Main.main.getCurrentDataSet().getSelectedWays().size() == 1
    74                 && Main.main.getCurrentDataSet().getSelectedWays().iterator().next().firstNode() == Main.main.getCurrentDataSet()
    75                         .getSelectedWays().iterator().next().lastNode());
     72        boolean enabledState = false;
     73        DataSet ds = Main.main.getCurrentDataSet();
     74        if (newSelection != null && ds != null) {
     75            Collection<Way> selectedWays = ds.getSelectedWays();
     76            enabledState = selectedWays.size() == 1 && selectedWays.iterator().next().isClosed();
     77        }
     78        setEnabled(enabledState);
    7679    }
    7780}
Note: See TracChangeset for help on using the changeset viewer.