mirror of
https://github.com/discourse/discourse.git
synced 2025-08-21 19:11:18 +08:00
FIX: exception in excerpt parser for null nodes
This commit is contained in:
parent
df5142493c
commit
a83bd537f4
1 changed files with 3 additions and 0 deletions
|
@ -132,6 +132,9 @@ class ExcerptParser < Nokogiri::XML::SAX::Document
|
|||
|
||||
def characters(string, truncate = true, count_it = true, encode = true)
|
||||
return if @in_quote
|
||||
# we call length on this so might as well ensure we have a string
|
||||
string = string.to_s
|
||||
|
||||
encode = encode ? lambda { |s| ERB::Util.html_escape(s) } : lambda { |s| s }
|
||||
if count_it && @current_length + string.length > @length
|
||||
length = [0, @length - @current_length - 1].max
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue