Skip to content

Commit

Permalink
Handle std::out_of_range exception thrown in getMarkdownWorklet o…
Browse files Browse the repository at this point in the history
…n iOS (#610)
  • Loading branch information
tomekzaw authored Jan 31, 2025
1 parent 2de4c02 commit 657946f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apple/MarkdownParser.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ @implementation MarkdownParser {
const auto &markdownRuntime = expensify::livemarkdown::getMarkdownRuntime();
jsi::Runtime &rt = markdownRuntime->getJSIRuntime();

const auto &markdownWorklet = expensify::livemarkdown::getMarkdownWorklet([parserId intValue]);
std::shared_ptr<ShareableWorklet> markdownWorklet;
try {
markdownWorklet = expensify::livemarkdown::getMarkdownWorklet([parserId intValue]);
} catch (const std::out_of_range &error) {
_prevText = text;
_prevParserId = parserId;
_prevMarkdownRanges = @[];
return _prevMarkdownRanges;
}

const auto &input = jsi::String::createFromUtf8(rt, [text UTF8String]);

Expand Down

0 comments on commit 657946f

Please sign in to comment.