changeset 47174:9ccac4332a21

8185890: Intermittent NPE in JLightweightFrame when updating cursor aceoss multiple graphics devices Reviewed-by: azvegint
author psadhukhan
date Thu, 10 Aug 2017 10:46:19 +0530
parents 948b0623c6d6
children b3576e4d78f3
files jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java	Thu Aug 10 10:41:04 2017 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java	Thu Aug 10 10:46:19 2017 +0530
@@ -509,7 +509,16 @@
      * and could not be overridden.
      */
     private void updateClientCursor() {
-        Point p = MouseInfo.getPointerInfo().getLocation();
+        PointerInfo pointerInfo = MouseInfo.getPointerInfo();
+        if (pointerInfo == null) {
+            /*
+             * This can happen when multiple graphics device cannot decide
+             * which graphics device contains the current mouse position
+             * or on systems without a mouse
+             */
+             return;
+        }
+        Point p = pointerInfo.getLocation();
         SwingUtilities.convertPointFromScreen(p, this);
         Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
         if (target != null) {