Bugs: Browse | Submit New | Admin

[#7470] Exception when input has trailing newlines

Date:
2006-12-27 20:11
Priority:
3
Submitted By:
Andrea Censi (andrea)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Exception when input has trailing newlines

Detailed description
This input makes it crash:

"<div style=\"text-align:center\">Div</div>\n\n\n"


Exception: TypeError: cannot convert nil into String
        /sw/lib/ruby/gems/1.8/gems/syntax-1.0.0/lib/syntax/common.rb:121:in `<<'
        /sw/lib/ruby/gems/1.8/gems/syntax-1.0.0/lib/syntax/common.rb:121:in `append'
        /sw/lib/ruby/gems/1.8/gems/syntax-1.0.0/lib/syntax/lang/xml.rb:73:in `step'
        /sw/lib/ruby/gems/1.8/gems/syntax-1.0.0/lib/syntax/common.rb:77:in `tokenize'
        /sw/lib/ruby/gems/1.8/gems/syntax-1.0.0/lib/syntax/convertors/html.rb:16:in `convert'

Add A Comment: Notepad

Please login


Followup

Message
Date: 2007-01-26 23:06
Sender: Hellekin Wolf

Here is a patch:

--- lib/syntax/common.rb~   2007-01-27 00:01:47.000000000  +0100
+++ lib/syntax/common.rb    2007-01-27 00:02:48.000000000 +0100
@@ -118,7 +118,8 @@

       # Append the given data to the currently active chunk.
       def append( data )
-        @chunk << data
+        @chunk << data if data
+        @chunk
       end

       # Request that a new group be started. If the current
group is the same

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item