PopupFactory: fixed NPE on Windows 10 when owner is null (issue #952)

This commit is contained in:
Karl Tauber
2025-01-09 12:26:57 +01:00
parent 0ad3180b10
commit d17fffb82a
2 changed files with 3 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ FlatLaf Change Log
- FileChooser: Improved performance when navigating to large directories with
thousands of files. (issue #953)
- PopupFactory: Fixed NPE on Windows 10 when `owner` is `null`. (issue #952)
## 3.5.4

View File

@@ -138,7 +138,7 @@ public class FlatPopupFactory
// create drop shadow popup
Popup popupForScreenOfOwner = getPopupForScreenOfOwner( owner, contents, x, y, forceHeavyWeight );
GraphicsConfiguration gc = owner.getGraphicsConfiguration();
GraphicsConfiguration gc = (owner != null) ? owner.getGraphicsConfiguration() : null;
return (gc != null && gc.isTranslucencyCapable())
? new DropShadowPopup( popupForScreenOfOwner, owner, contents )
: new NonFlashingPopup( popupForScreenOfOwner, owner, contents );
@@ -306,7 +306,7 @@ public class FlatPopupFactory
break;
}
}
if( gc == null )
if( gc == null && owner != null )
gc = owner.getGraphicsConfiguration();
if( gc == null )
return null;