fix excerpt code

This commit is contained in:
Sam 2014-11-10 21:07:43 +11:00
parent a90176550c
commit 2920cfc319
1 changed files with 1 additions and 1 deletions

View File

@ -133,7 +133,7 @@ module FlagQuery
excerpt = Post.excerpt(cooked, 200)
# remove the first link if it's the first node
fragment = Nokogiri::HTML.fragment(excerpt)
if fragment.children.first == fragment.css("a:first").first
if fragment.children.first == fragment.css("a:first").first && fragment.children.first
fragment.children.first.remove
end
fragment.to_html.strip