Handling null pointer on non-Mac systems. #118

This commit is contained in:
Rob Greene 2023-10-27 21:52:22 -05:00
parent 7819a0cfa8
commit 6deb104ff7

View File

@ -130,9 +130,11 @@ public class SwtAppleCommander implements Listener {
Display.setAppName(textBundle.get("SwtAppleCommander.AppleCommander")); //$NON-NLS-1$ Display.setAppName(textBundle.get("SwtAppleCommander.AppleCommander")); //$NON-NLS-1$
// Find the system About menu on Mac OS X. // Find the system About menu on Mac OS X.
// See https://www.eclipse.org/swt/R3_7/new_and_noteworthy.html#m6 // See https://www.eclipse.org/swt/R3_7/new_and_noteworthy.html#m6
for (MenuItem item : display.getSystemMenu().getItems()) { if (display.getSystemMenu() != null) {
if (item.getID() == SWT.ID_ABOUT) { for (MenuItem item : display.getSystemMenu().getItems()) {
item.addSelectionListener(widgetSelectedAdapter(e -> showAboutAppleCommander())); if (item.getID() == SWT.ID_ABOUT) {
item.addSelectionListener(widgetSelectedAdapter(e -> showAboutAppleCommander()));
}
} }
} }
shell = new Shell(display, SWT.BORDER | SWT.CLOSE | SWT.MIN | SWT.TITLE); shell = new Shell(display, SWT.BORDER | SWT.CLOSE | SWT.MIN | SWT.TITLE);