Skip to content

fix: Prevent crash from malformed links - #127

Open
lebojo wants to merge 1 commit into
bmoliveira:masterfrom
lebojo:master
Open

lebojo wants to merge 1 commit into
bmoliveira:masterfrom
lebojo:master

Conversation

@lebojo

@lebojo lebojo commented Dec 23, 2025

Copy link
Copy Markdown

This pull request improves the robustness of the MarkdownLink element parsing in MarkdownLink.swift by adding checks to prevent crashes on malformed links and by refactoring code to use named variables for better readability and maintainability.

Concretely:

  • Added guard statements to prevent crashes when parsing malformed markdown links by checking the number of ranges and valid locations before proceeding.

@demianturner

Copy link
Copy Markdown

Thanks @lebojo — this fix works well for me and resolves the crash. I’ve applied it in my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants