Fix NPE in ScreenShotPlugin

Fix NPE that happens when titlebar is not present (not using the custom
window decorations) and plugin is trying to remove the screenshot
button from titlebar.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-01-20 17:50:00 +01:00
parent 71fdfcf14a
commit 46ea18801d

View File

@@ -169,10 +169,13 @@ public class ScreenshotPlugin extends Plugin
SwingUtilities.invokeLater(() ->
{
JComponent titleBar = SubstanceCoreUtilities.getTitlePaneComponent(clientUi);
titleBar.remove(titleBarButton);
clientUi.revalidate();
clientUi.repaint();
if (titleBar != null)
{
titleBar.remove(titleBarButton);
clientUi.revalidate();
clientUi.repaint();
}
});
}