Skip to content

Crash in [Talkable offerTargetFor:] #20

Closed
@ehyche

Description

@ehyche

We are seeing a crash in Crashlytics that looks like this:

Screenshot 2023-01-26 at 2 59 58 PM

The code in question is here:

- (TKBLOfferTarget*)offerTargetFor:(WKWebView*) webView {
    if (!_offerTargets) {
        _offerTargets = [NSMutableArray new];
    }
    for (TKBLOfferTarget* target in _offerTargets) {
        if (![target isUsed])
            [_offerTargets removeObject:target];
    }
    TKBLOfferTarget* target = [[TKBLOfferTarget alloc] initWithWebView:webView];
    [_offerTargets addObject:target];
    return target;
}

and it does indeed look like if [target isUsed] returns NO, then we will mutate the _offerTargets array while we are iterating it.

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions