hpricot 0.4.76 chokes on empty comment.

Discussion in 'Ruby' started by Ron M, Dec 5, 2006.

  1. Ron M

    Ron M Guest

    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
     
    Ron M, Dec 5, 2006
    #1
    1. Advertising

  2. Ron M

    _why Guest

    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
     
    _why, Dec 5, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alec S.
    Replies:
    10
    Views:
    10,265
    Alec S.
    Apr 16, 2005
  2. William Payne

    New compiler chokes on template class

    William Payne, Aug 21, 2004, in forum: C++
    Replies:
    3
    Views:
    389
    Old Wolf
    Aug 22, 2004
  3. ‘5ÛHH575-UAZWKVVP-7H2H48V3
    Replies:
    7
    Views:
    694
    Kanenas
    Feb 15, 2005
  4. Bram Stolk
    Replies:
    4
    Views:
    353
    Bram Stolk
    May 25, 2005
  5. Rene Pijlman
    Replies:
    6
    Views:
    701
    Fredrik Lundh
    May 29, 2006
Loading...

Share This Page