Skip to content

Commit

Permalink
Move the null check earlier to prevent setting up a parser for no rea…
Browse files Browse the repository at this point in the history
…son.
  • Loading branch information
jasonvarga committed Sep 24, 2020
1 parent e9da82e commit 064a774
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Fieldtypes/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public function filter()

public function augment($value)
{
if (is_null($value)) {
return;
}

$markdown = \Statamic\Facades\Markdown::parser(
$this->config('parser', 'default')
);
Expand All @@ -95,10 +99,6 @@ public function augment($value)
$markdown = $markdown->withSmartPunctuation();
}

if (is_null($value)) {
return;
}

$html = $markdown->parse((string) $value);

return $html;
Expand Down

0 comments on commit 064a774

Please sign in to comment.