hpricot 0.4.76 chokes on empty comment.

R

Ron M

Hpricot's choking on some pages complaining about nil
in Comment#parse. I can't remember the HTML page that
was parsing it; but this patch fixes the problem for me.

Why? If you're around, should something like this be checked
in the main project?

Ron


desktop2:/usr/local/lib/ruby/gems/1.8/gems/hpricot-0.4.76/lib/hpricot% diff -c parse.rb.orig parse.rb
*** parse.rb.orig Fri Dec 1 16:53:58 2006
--- parse.rb Fri Dec 1 16:54:04 2006
***************
*** 261,267 ****

def Comment.parse(content)
result = Comment.new(content)
! result.raw_string = "<!--" + content + "-->"
result
end

--- 261,267 ----

def Comment.parse(content)
result = Comment.new(content)
! result.raw_string = "<!--" + (content||'') + "-->"
result
end
 
W

_why

Hpricot's choking on some pages complaining about nil
in Comment#parse. I can't remember the HTML page that
was parsing it; but this patch fixes the problem for me.

Why? If you're around, should something like this be checked
in the main project?

It's in. Way to be, Ron!

_why
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top