# Hpricot 0.4.76 chokes on empty comment

**URL:** <https://www.ruby-forum.com/t/hpricot-0-4-76-chokes-on-empty-comment/78335>\
**Category:** Ruby\
**Created:** [December 5, 2006, 2:13am UTC](https://www.ruby-forum.com/t/hpricot-0-4-76-chokes-on-empty-comment/78335 "2006-12-05T02:13:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ron\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@Ron\_M](https://www.ruby-forum.com/u/Ron_M)\
**Post date:** [December 5, 2006, 2:13am UTC](https://www.ruby-forum.com/t/hpricot-0-4-76-chokes-on-empty-comment/78335/1 "2006-12-05T02:13:51Z")

</div>

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 = “”  
result  
end

— 261,267 ----

```
def Comment.parse(content)
  result = Comment.new(content)

```

! result.raw\_string = “”  
result  
end

---

<div class="post-metadata">

**Author:** ![Ron\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@Ron\_M](https://www.ruby-forum.com/u/Ron_M)\
**Post date:** [December 5, 2006, 5:29pm UTC](https://www.ruby-forum.com/t/hpricot-0-4-76-chokes-on-empty-comment/78335/2 "2006-12-05T17:29:47Z")

</div>

On Tue, Dec 05, 2006 at 10:11:42AM +0900, Ron M wrote:

> 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
