Ignore:
Timestamp:
2016-12-14T15:50:53+01:00 (3 years ago)
Author:
Don-vip
Message:

sonar - squid:S2259 - Null pointers should not be dereferenced

File:
1 edited

Legend:

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

    r10875 r11397  
    499499                    }
    500500                }
    501             } else {
     501            } else if (bestMovement != null) {
    502502                if (mode == Mode.extrude || mode == Mode.create_new) {
    503503                    //nothing here
     
    897897        // set neighboring segments
    898898        Node prevNode = getPreviousNode(selectedSegment.lowerIndex);
    899         EastNorth prevNodeEn = prevNode.getEastNorth();
    900         dualAlignSegment1 = new ReferenceSegment(new EastNorth(
    901             initialN1en.getX() - prevNodeEn.getX(),
    902             initialN1en.getY() - prevNodeEn.getY()
    903             ), initialN1en, prevNodeEn, false);
     899        if (prevNode != null) {
     900            EastNorth prevNodeEn = prevNode.getEastNorth();
     901            dualAlignSegment1 = new ReferenceSegment(new EastNorth(
     902                initialN1en.getX() - prevNodeEn.getX(),
     903                initialN1en.getY() - prevNodeEn.getY()
     904                ), initialN1en, prevNodeEn, false);
     905        }
    904906
    905907        Node nextNode = getNextNode(selectedSegment.lowerIndex + 1);
    906         EastNorth nextNodeEn = nextNode.getEastNorth();
    907         dualAlignSegment2 = new ReferenceSegment(new EastNorth(
    908             initialN2en.getX() - nextNodeEn.getX(),
    909             initialN2en.getY() - nextNodeEn.getY()
    910             ), initialN2en, nextNodeEn, false);
     908        if (nextNode != null) {
     909            EastNorth nextNodeEn = nextNode.getEastNorth();
     910            dualAlignSegment2 = new ReferenceSegment(new EastNorth(
     911                initialN2en.getX() - nextNodeEn.getX(),
     912                initialN2en.getY() - nextNodeEn.getY()
     913                ), initialN2en, nextNodeEn, false);
     914        }
    911915    }
    912916
Note: See TracChangeset for help on using the changeset viewer.