Skip to content

Commit e6a8b37

Browse files
authored
Ignore failure to parse some older java version information
1 parent 0b0b345 commit e6a8b37

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/nativeStub.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,14 @@ - (NSString *)description {
471471
NSString *result = execute(path, @[@"-version"]);
472472
// The actual version will be between the first two quotes in the result
473473
// We can reasonably ignore all the rest of the output
474-
return [result componentsSeparatedByString:@"\""][1];
474+
NSArray *components = [result componentsSeparatedByString:@"\""];
475+
if (components.count > 1) {
476+
return components[1];
477+
} else {
478+
// Handle unexpected format
479+
NSLog(@"Error: Unexpected version string format: %@", result);
480+
return nil;
481+
}
475482
}
476483

477484
NSString *normalizeJavaVersion(NSString *version) {

0 commit comments

Comments
 (0)