git: 0de164bdb551 - main - java/openjdk17: Fix an NPE when using a multi-screen X11 setup

From: Greg Lewis <glewis_at_FreeBSD.org>
Date: Tue, 31 May 2022 00:44:27 UTC
The branch main has been updated by glewis:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0de164bdb551505ac86059866d855a8035de983f

commit 0de164bdb551505ac86059866d855a8035de983f
Author:     Sean Farley <scf@FreeBSD.org>
AuthorDate: 2022-05-31 00:37:59 +0000
Commit:     Greg Lewis <glewis@FreeBSD.org>
CommitDate: 2022-05-31 00:42:52 +0000

    java/openjdk17: Fix an NPE when using a multi-screen X11 setup
    
    PR:             264356
    Reported by:    scf@
---
 ...a.desktop_unix_classes_sun_awt_X11GraphicsEnvironment.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/java/openjdk17/files/patch-src_java.desktop_unix_classes_sun_awt_X11GraphicsEnvironment.java b/java/openjdk17/files/patch-src_java.desktop_unix_classes_sun_awt_X11GraphicsEnvironment.java
new file mode 100644
index 000000000000..7019cf8b290d
--- /dev/null
+++ b/java/openjdk17/files/patch-src_java.desktop_unix_classes_sun_awt_X11GraphicsEnvironment.java
@@ -0,0 +1,11 @@
+--- src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java
++++ src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java
+@@ -232,7 +232,7 @@ public final class X11GraphicsEnvironment extends SunGraphicsEnvironment {
+             throw new AWTError("no screen devices");
+         }
+         int index = getDefaultScreenNum();
+-        mainScreen = 0 < index && index < screens.length ? index : 0;
++        mainScreen = 0 < index && index < numScreens ? index : 0;
+ 
+         for (int id = 0; id < numScreens; ++id) {
+             devices.put(id, old.containsKey(id) ? old.remove(id) :