Skip to content

Commit

Permalink
Fixes issue #126
Browse files Browse the repository at this point in the history
More null checks.
  • Loading branch information
andrewauclair committed Nov 17, 2023
1 parent 38b395f commit 3c48874
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions docking-api/src/ModernDocking/api/RootDockingPanelAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ of this software and associated documentation files (the "Software"), to deal
public class RootDockingPanelAPI extends DockingPanel {
private DockingAPI docking = null;

private Window window;
private Window window = null;

private DockingPanel panel;
private DockingPanel panel = null;

private JPanel emptyPanel = new JPanel();

Expand All @@ -51,17 +51,17 @@ public class RootDockingPanelAPI extends DockingPanel {
/**
* South toolbar of this panel. Only created if pinning is supported.
*/
private DockableToolbar southToolbar;
private DockableToolbar southToolbar = null;
/**
* West toolbar of this panel. Only created if pinning is supported.
*/
private DockableToolbar westToolbar;
private DockableToolbar westToolbar = null;
/**
* East toolbar of this panel. Only created if pinning is supported.
*/
private DockableToolbar eastToolbar;
private DockableToolbar eastToolbar = null;

private EnumSet<ToolbarLocation> supportedToolbars;
private EnumSet<ToolbarLocation> supportedToolbars = EnumSet.noneOf(ToolbarLocation.class);

/**
* Create root panel with GridBagLayout as the layout
Expand Down Expand Up @@ -238,10 +238,10 @@ private boolean removeExistingPanel() {

@Override
public void removeNotify() {
Window rootWindow = (Window) SwingUtilities.getRoot(this);

// this class has a default constructor which could be called and docking would be null
if (docking != null) {
Window rootWindow = (Window) SwingUtilities.getRoot(this);

docking.deregisterDockingPanel(rootWindow);
}

Expand Down Expand Up @@ -432,9 +432,15 @@ private void createContents() {
* Hide all unpinned panels on the west, south and east toolbars
*/
public void hideUnpinnedPanels() {
westToolbar.hideAll();
southToolbar.hideAll();
eastToolbar.hideAll();
if (westToolbar != null) {
westToolbar.hideAll();
}
if (southToolbar != null) {
southToolbar.hideAll();
}
if (eastToolbar != null) {
eastToolbar.hideAll();
}
}

/**
Expand Down

0 comments on commit 3c48874

Please sign in to comment.