Skip to content

Commit

Permalink
Merge pull request #84 from jbarnette/patch-1
Browse files Browse the repository at this point in the history
Guard against nil node replacement results
  • Loading branch information
jch committed Sep 16, 2013
2 parents f778374 + 95350d7 commit b376452
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/html/pipeline/syntax_highlight_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ def call
html = highlight_with_timeout_handling(lexer, text)
next if html.nil?

node = node.replace(html).first
klass = node["class"]
klass = [klass, "highlight-#{lang}"].compact.join " "
if (node = node.replace(html).first)
klass = node["class"]
klass = [klass, "highlight-#{lang}"].compact.join " "

node["class"] = klass
node["class"] = klass
end
end
doc
end
Expand Down

0 comments on commit b376452

Please sign in to comment.