Skip to content

addLinks: crash #826

Description

@guanzhendong
- (void)addLinks:(NSArray *)links {
  NSMutableArray *mutableLinkModels = [NSMutableArray arrayWithArray:self.linkModels];

  NSMutableAttributedString *mutableAttributedString = [self.attributedText mutableCopy];

  for (TTTAttributedLabelLink *link in links) {
​    if (link.attributes) {
​      [mutableAttributedString addAttributes:link.attributes range:link.result.range];
​    }
  }

  self.attributedText = mutableAttributedString;
  [self setNeedsDisplay];

  [mutableLinkModels addObjectsFromArray:links];

  self.linkModels = [NSArray arrayWithArray:mutableLinkModels];
}

[mutableAttributedString addAttributes:link.attributes range:link.result.range];这一行发生了越界崩溃

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions