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,11 +130,13 @@ 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
if (display.getSystemMenu() != null) {
for (MenuItem item : display.getSystemMenu().getItems()) { for (MenuItem item : display.getSystemMenu().getItems()) {
if (item.getID() == SWT.ID_ABOUT) { if (item.getID() == SWT.ID_ABOUT) {
item.addSelectionListener(widgetSelectedAdapter(e -> showAboutAppleCommander())); 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);
shell.setText(textBundle.get("SwtAppleCommander.AppleCommander")); //$NON-NLS-1$ shell.setText(textBundle.get("SwtAppleCommander.AppleCommander")); //$NON-NLS-1$
shell.setImage(imageManager.get(ImageManager.ICON_DISK)); shell.setImage(imageManager.get(ImageManager.ICON_DISK));