AttributedMarkdown icon indicating copy to clipboard operation
AttributedMarkdown copied to clipboard

Crashes when Emails included in markdown

Open joelfischerr opened this issue 10 years ago • 3 comments

When there are email adresses included in the document, markdown_output.m crashes.

case LINK:;
        NSURL *url = [NSURL URLWithString:elt->contents.link->url];
        if (url) {
            NSDictionary *linkAttibutes = @{@"attributedMarkdownURL": url};
            print_attr_element_list(out, elt->contents.link->label, attributes, merge(current, merge(attributes[elt->key], linkAttibutes)));
        } else {
            NSDictionary *attributesBroken = @{NSForegroundColorAttributeName: [TARGET_PLATFORM_COLOR redColor]}; // Make this attributes[BROKEN]
            print_attr_element_list(out, elt->contents.link->label, attributes, merge(current, attributesBroken));
            print_attr_string(out, [NSString stringWithFormat: @" (%@)", elt->contents.link->url], current);
        }
        break;

joelfischerr avatar May 02 '14 09:05 joelfischerr

Hmm, my guess is that elt->contents.link->url is null here. Confirm?

dreamwieber avatar May 02 '14 16:05 dreamwieber

Yes

joelfischerr avatar May 04 '14 13:05 joelfischerr

You could probably get around the crash for now by inserting an empty string rather than a nil one for now.

Sent from my iPhone

On May 4, 2014, at 6:06 AM, joelfischerr [email protected] wrote:

Yes

— Reply to this email directly or view it on GitHub.

dreamwieber avatar May 04 '14 19:05 dreamwieber