Skip to content

Translator crashes silently on nil path on iOS/iPad #11

@ghost

Description

Deleting the ~/Library/Application\ Support/Greenwich\ Translator folder fixes the problem until the next time its recreated. Attached is a simple fix that tests for nil on the "path" variable.

  • SK

  • (void)processUpdates:(NSMetadataQuery *)query {
    [query disableUpdates];

    FRLocalizationWindowController *windowController = [[self class] sharedLocalizationWindowController];

    for (NSUInteger i = 0; i < [query resultCount]; i++) {
    NSMetadataItem *theResult = [query resultAtIndex:i];
    NSString *path = [theResult valueForAttribute:(NSString *)kMDItemPath];

pragma mark - SK -

    if ((path != nil) && (![knownContainers containsObject:path]))

pragma mark - /SK -

    {
        NSURL *appInfoURL = [NSURL fileURLWithPath:path];
        NSURL *appURL = [appInfoURL URLByDeletingLastPathComponent];
        NSDictionary *appInfo = [NSDictionary dictionaryWithContentsOfURL:appInfoURL];
        if (appInfo) {
            FRTranslationContainer *container =
                [FRTranslationContainer containerForSyncedApplicationResources:appURL];
            container.name = [appInfo objectForKey:kApplicationNameKey];
            [windowController addContainer:container];
        }
        [knownContainers addObject:path];
    }
}

[query enableUpdates];

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions