Changeset 3156 in josm for trunk/src


Ignore:
Timestamp:
2010-03-25T20:53:23+01:00 (10 years ago)
Author:
jttt
Message:

Fix NPE in case SplitWayAction show message dialog

File:
1 edited

Legend:

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

    r3152 r3156  
    190190
    191191        List<List<Node>> wayChunks = buildSplitChunks(selectedWay, selectedNodes);
    192         SplitWayResult result = splitWay(getEditLayer(),selectedWay, wayChunks);
    193         Main.main.undoRedo.add(result.getCommand());
    194         getCurrentDataSet().setSelected(result.getNewSelection());
     192        if (wayChunks != null) {
     193            SplitWayResult result = splitWay(getEditLayer(),selectedWay, wayChunks);
     194            Main.main.undoRedo.add(result.getCommand());
     195            getCurrentDataSet().setSelected(result.getNewSelection());
     196        }
    195197    }
    196198
     
    219221     * Splits the nodes of {@code wayToSplit} into a list of node sequences
    220222     * which are separated at the nodes in {@code splitPoints}.
    221      * 
     223     *
    222224     * This method displays warning messages if {@code wayToSplit} and/or
    223225     * {@code splitPoints} aren't consistent.
    224      * 
     226     *
    225227     * Returns null, if building the split chunks fails.
    226      * 
     228     *
    227229     * @param wayToSplit the way to split. Must not be null.
    228230     * @param splitPoints the nodes where the way is split. Must not be null.
     
    481483     * Splits the way {@code way} at the nodes in {@code atNodes} and replies
    482484     * the result of this process in an instance of {@see SplitWayResult}.
    483      * 
     485     *
    484486     * Note that changes are not applied to the data yet. You have to
    485487     * submit the command in {@see SplitWayResult#getCommand()} first,
    486488     * i.e. {@code Main.main.undoredo.add(result.getCommand())}.
    487      * 
     489     *
    488490     * Replies null if the way couldn't be split at the given nodes.
    489      * 
     491     *
    490492     * @param layer the layer which the way belongs to. Must not be null.
    491493     * @param way the way to split. Must not be null.
Note: See TracChangeset for help on using the changeset viewer.