mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:44:49 +08:00
FIX: exception in excerpt parser for null nodes
This commit is contained in:
parent
df5142493c
commit
a83bd537f4
|
@ -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…
Reference in New Issue
Block a user