Changeset 13151 in josm for trunk


Ignore:
Timestamp:
2017-11-23T15:36:02+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #15585 - NPE

File:
1 edited

Legend:

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

    r12636 r13151  
    44import java.awt.MouseInfo;
    55import java.awt.Point;
     6import java.awt.PointerInfo;
    67import java.awt.datatransfer.FlavorEvent;
    78import java.awt.datatransfer.FlavorListener;
     
    7576        // Observed behaviour: getActionCommand() returns Action.NAME when triggered via menu, but shortcut text when triggered with it
    7677        if (e != null && !getValue(NAME).equals(e.getActionCommand())) {
    77             final Point mp = MouseInfo.getPointerInfo().getLocation();
    78             final Point tl = mapView.getLocationOnScreen();
    79             final Point pos = new Point(mp.x-tl.x, mp.y-tl.y);
    80             if (mapView.contains(pos)) {
    81                 mPosition = mapView.getEastNorth(pos.x, pos.y);
     78            final PointerInfo pointerInfo = MouseInfo.getPointerInfo();
     79            if (pointerInfo != null) {
     80                final Point mp = pointerInfo.getLocation();
     81                final Point tl = mapView.getLocationOnScreen();
     82                final Point pos = new Point(mp.x-tl.x, mp.y-tl.y);
     83                if (mapView.contains(pos)) {
     84                    mPosition = mapView.getEastNorth(pos.x, pos.y);
     85                }
    8286            }
    8387        }
Note: See TracChangeset for help on using the changeset viewer.