8288854: getLocalGraphicsEnvironment() on for multi-screen setups throws exception NPE

Reviewed-by: azvegint, aivanov
This commit is contained in:
Sergey Bylokhov 2022-07-02 00:25:20 +00:00
parent 9925014035
commit cfc9a881af

@ -236,7 +236,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) :