diff --git a/build/conf/mac/Contents/MacOS/idea b/build/conf/mac/Contents/MacOS/idea index 12d1312c23f4..b1ad14f59d40 100755 Binary files a/build/conf/mac/Contents/MacOS/idea and b/build/conf/mac/Contents/MacOS/idea differ diff --git a/native/MacLauncher/Launcher.m b/native/MacLauncher/Launcher.m index e16e6b56f421..e949ef8c3288 100644 --- a/native/MacLauncher/Launcher.m +++ b/native/MacLauncher/Launcher.m @@ -147,16 +147,19 @@ NSBundle *findMatchingVm() { NSString *required = requiredJvmVersion(); debugLog([NSString stringWithFormat:@"Required VM: %@", required]); - for (NSBundle *vm in vmBundles) { + if (required != nil && required != NULL) { + for (NSBundle *vm in vmBundles) { if (satisfies(jvmVersion(vm), required)) { debugLog(@"Chosen VM:"); debugLog([vm bundlePath]); return vm; } + } + } else { + NSLog(@"Info.plist is corrupted, Absent JVMOptios key."); + exit(-1); } - - debugLog(@"No matching VM found"); - + NSLog(@"No matching VM found."); return nil; } @@ -174,14 +177,21 @@ CFBundleRef NSBundle2CFBundle(NSBundle *bundle) { - (NSMutableString *)buildClasspath:(NSBundle *)jvm { NSDictionary *jvmInfo = [[NSBundle mainBundle] objectForInfoDictionaryKey:JVMOptions]; NSMutableString *classpathOption = [NSMutableString stringWithString:@"-Djava.class.path="]; - [classpathOption appendString:[jvmInfo objectForKey:@"ClassPath"]]; - - NSString *toolsJar = [[jvm bundlePath] stringByAppendingString:@"/Contents/Home/lib/tools.jar"]; - if ([[NSFileManager defaultManager] fileExistsAtPath:toolsJar]) { + NSString *classPath = [jvmInfo objectForKey:@"ClassPath"]; + if (classPath != nil && classPath != NULL) { + [classpathOption appendString:[jvmInfo objectForKey:@"ClassPath"]]; + NSString *toolsJar = [[jvm bundlePath] stringByAppendingString:@"/Contents/Home/lib/tools.jar"]; + if ([[NSFileManager defaultManager] fileExistsAtPath:toolsJar]) { [classpathOption appendString:@":"]; [classpathOption appendString:toolsJar]; + } + + } else { + NSLog(@"Info.plist is corrupted, Absent ClassPath key."); + exit(-1); } - return classpathOption; + + return classpathOption; } @@ -263,6 +273,13 @@ NSDictionary *parseProperties() { - (const char *)mainClassName { NSDictionary *jvmInfo = [[NSBundle mainBundle] objectForInfoDictionaryKey:JVMOptions]; + + NSString *mainClass = [jvmInfo objectForKey:@"MainClass"]; + if (mainClass == nil || mainClass == NULL) { + NSLog(@"Info.plist is corrupted, Absent MainClass key."); + exit(-1); + } + char *answer = strdup([[jvmInfo objectForKey:@"MainClass"] UTF8String]); char *cur = answer; @@ -279,11 +296,14 @@ NSDictionary *parseProperties() { - (void)process_cwd { NSDictionary *jvmInfo = [[NSBundle mainBundle] objectForInfoDictionaryKey:JVMOptions]; NSString *cwd = [jvmInfo objectForKey:@"WorkingDirectory"]; - if (cwd != nil) { + if (cwd != nil && cwd != NULL) { cwd = [self expandMacros:cwd]; if (chdir([cwd UTF8String]) != 0) { NSLog(@"Cannot chdir to working directory at %@", cwd); } + } else { + NSLog(@"Info.plist is corrupted, Absent WorkingDirectory key."); + exit(-1); } } @@ -390,5 +410,4 @@ NSDictionary *parseProperties() { [pool release]; } - @end \ No newline at end of file