Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2019-03-06 11:09:32 +0000
committerLakshmi Shanmugam2019-03-12 08:10:46 +0000
commit7a256e2e3c59e029a07d7c5319f7d366b59e1c3c (patch)
tree278152a92da1c19e26dcbd850e4e6d7e8a4a16b9
parent1185e749e06092bd4c634b07427b7332e8eb6f5d (diff)
downloadeclipse.platform.swt-7a256e2e3c59e029a07d7c5319f7d366b59e1c3c.tar.gz
eclipse.platform.swt-7a256e2e3c59e029a07d7c5319f7d366b59e1c3c.tar.xz
eclipse.platform.swt-7a256e2e3c59e029a07d7c5319f7d366b59e1c3c.zip
Bug 379009 - NullPointerException in
Display.applicationWillFinishLaunching Add null check for bundle returned by NSBundle.bundleWithIdentifier. Change-Id: Ic70b1824d022f5b05fc24061db019813541aeb5d
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
index 0d32414dab..1375180d19 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
@@ -5443,16 +5443,19 @@ void applicationWillFinishLaunching (long /*int*/ id, long /*int*/ sel, long /*i
* /System/Library/..../Resources/English.lproj/DefaultApp.nib.
* /System/Library/..../Resources/en.lproj/DefaultApp.nib.
*/
- NSBundle bundle = NSBundle.bundleWithIdentifier(NSString.stringWith("com.apple.JavaVM"));
+ NSString path;
NSDictionary dict = NSDictionary.dictionaryWithObject(applicationDelegate, NSString.stringWith("NSOwner"));
- NSString path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, languageDisplayName);
- if (path == null) path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, NSString.stringWith(languageISOValue));
- if (path == null) path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"));
- if (!loaded) loaded = path != null && NSBundle.loadNibFile(path, dict, 0);
- if (!loaded) {
- path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, NSString.stringWith("English"));
- if (path == null) path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, NSString.stringWith("en"));
- loaded = path != null && NSBundle.loadNibFile(path, dict, 0);
+ NSBundle bundle = NSBundle.bundleWithIdentifier(NSString.stringWith("com.apple.JavaVM"));
+ if (bundle != null) {
+ path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, languageDisplayName);
+ if (path == null) path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, NSString.stringWith(languageISOValue));
+ if (path == null) path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"));
+ if (!loaded) loaded = path != null && NSBundle.loadNibFile(path, dict, 0);
+ if (!loaded) {
+ path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, NSString.stringWith("English"));
+ if (path == null) path = bundle.pathForResource(NSString.stringWith("DefaultApp"), NSString.stringWith("nib"), null, NSString.stringWith("en"));
+ loaded = path != null && NSBundle.loadNibFile(path, dict, 0);
+ }
}
if (!loaded) {
path = NSString.stringWith(System.getProperty("java.home") + "/../Resources/English.lproj/DefaultApp.nib");

Back to the top