Bug #516

REXML::Text#wrapは空白が含まれない場合を想定していない

Added by Sakuro OZAWA almost 7 years ago. Updated over 4 years ago.

[ruby-dev:36045]
Status:Closed
Priority:Normal
Assignee:Sean Russell
ruby -v: Backport:

Description

=begin
空白が含まれない string に対して place = string.rindex(' ', width) とすると nil が返るところ、
これをチェックせずそのまま分割位置に利用しています。

$ ruby-trunk sample.rb
ruby 1.9.0 (2008-08-29 revision 18925) [i386-darwin9.4.0]
<?xml version='1.0'?>

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

<?xml version='1.0'?>

/usr/local/lib/ruby/1.9.0/rexml/formatters/pretty.rb:132:in []': no implicit conversion from nil to integer (TypeError)
from /usr/local/lib/ruby/1.9.0/rexml/formatters/pretty.rb:132:in
wrap'
from /usr/local/lib/ruby/1.9.0/rexml/formatters/pretty.rb:91:in write_text'
from /usr/local/lib/ruby/1.9.0/rexml/formatters/default.rb:50:in
write'
from /usr/local/lib/ruby/1.9.0/rexml/formatters/pretty.rb:76:in block in write_element'
from /usr/local/lib/ruby/1.9.0/rexml/formatters/pretty.rb:74:in
each'
from /usr/local/lib/ruby/1.9.0/rexml/formatters/pretty.rb:74:in write_element'
from /usr/local/lib/ruby/1.9.0/rexml/formatters/default.rb:31:in
write'
from /usr/local/lib/ruby/1.9.0/rexml/formatters/pretty.rb:118:in block in write_document'
from /usr/local/lib/ruby/1.9.0/rexml/formatters/pretty.rb:112:in
each'
from /usr/local/lib/ruby/1.9.0/rexml/formatters/pretty.rb:112:in write_document'
from /usr/local/lib/ruby/1.9.0/rexml/formatters/default.rb:28:in
write'
from sample.rb:11:in `'
=end

sample.rb Magnifier - 再現スクリプト (318 Bytes) Sakuro OZAWA, 08/29/2008 11:49 PM

History

#1 Updated by Koichi Sasada almost 7 years ago

  • Assignee set to Yukihiro Matsumoto

=begin

=end

#2 Updated by Koichi Sasada almost 7 years ago

  • Assignee changed from Yukihiro Matsumoto to Sean Russell

=begin

=end

#3 Updated by Yukihiro Matsumoto almost 7 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r19487.
=end

Also available in: Atom PDF