Skip to content

Commit 2dcec3a

Browse files
Fix crash when presenting error.
1 parent ffcf7e0 commit 2dcec3a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

BuildSettingExtractor/BuildSettingExtractor.m

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,17 @@ - (void)extractBuildSettingsFromProject:(NSURL *)projectWrapperURL toDestination
6666

6767
NSData *fileData = [NSData dataWithContentsOfURL:projectFileURL options:0 error:&error];
6868
if (!fileData) {
69-
[NSApp presentError:error];
69+
dispatch_async(dispatch_get_main_queue(), ^{
70+
[NSApp presentError:error];
71+
});
7072
} else {
7173

7274
NSDictionary *projectPlist = [NSPropertyListSerialization propertyListWithData:fileData options:NSPropertyListImmutable format:NULL error:&error];
7375

7476
if (!projectPlist) {
75-
[NSApp presentError:error];
77+
dispatch_async(dispatch_get_main_queue(), ^{
78+
[NSApp presentError:error];
79+
});
7680
} else {
7781

7882
// Get root object (project)
@@ -84,7 +88,9 @@ - (void)extractBuildSettingsFromProject:(NSURL *)projectWrapperURL toDestination
8488
if (![compatibilityVersion isEqualToString:XcodeCompatibilityVersionString]) {
8589
NSDictionary *userInfo = @{NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Unable to extract build settings from project ‘%@’.", [[projectWrapperURL lastPathComponent] stringByDeletingPathExtension]], NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:@"Project file format version ‘%@’ is not supported.", compatibilityVersion]};
8690
NSError *error = [NSError errorWithDomain:[[NSBundle mainBundle] bundleIdentifier] code:UnsupportedXcodeVersion userInfo:userInfo];
87-
[NSApp presentError:error];
91+
dispatch_async(dispatch_get_main_queue(), ^{
92+
[NSApp presentError:error];
93+
});
8894
return;
8995
}
9096

0 commit comments

Comments
 (0)