Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

to_tree bug #13

Closed
sunilkr opened this Issue Feb 5, 2013 · 2 comments

Comments

Projects
None yet
2 participants

sunilkr commented Feb 5, 2013

Exception trace.
Cannot attach the sample file here.
link: www.transportation.org/Documents/focus.ppt
(I do not own the presentation)

irb(main):015:0> ole
=> #<Ole::Storage io=#<File:focus.ppt> root=#<Dirent:"刀">>
irb(main):016:0> ole.root
=> #<Dirent:"刀">
irb(main):017:0> ole.root.to_tree
NoMethodError: undefined method `each' for nil:NilClass
    from /var/lib/gems/1.9.1/gems/ruby-ole-1.2.11.6/lib/ole/storage/base.rb:835:in `each_child'
    from /var/lib/gems/1.9.1/gems/ruby-ole-1.2.11.6/lib/ole/support.rb:143:in `block in to_tree'
    from /var/lib/gems/1.9.1/gems/ruby-ole-1.2.11.6/lib/ole/support.rb:146:in `call'
    from /var/lib/gems/1.9.1/gems/ruby-ole-1.2.11.6/lib/ole/support.rb:146:in `block (2 levels) in to_tree'
    from /var/lib/gems/1.9.1/gems/ruby-ole-1.2.11.6/lib/ole/storage/base.rb:835:in `each'
    from /var/lib/gems/1.9.1/gems/ruby-ole-1.2.11.6/lib/ole/storage/base.rb:835:in `each_child'
    from /var/lib/gems/1.9.1/gems/ruby-ole-1.2.11.6/lib/ole/support.rb:143:in `block in to_tree'
    from /var/lib/gems/1.9.1/gems/ruby-ole-1.2.11.6/lib/ole/support.rb:155:in `call'
    from /var/lib/gems/1.9.1/gems/ruby-ole-1.2.11.6/lib/ole/support.rb:155:in `to_tree'
    from (irb):17
    from /usr/bin/irb:12:in `<main>'
Owner

aquasync commented Feb 5, 2013

Thanks for the bug report. Looks this actually only used to work by accident (oops!), in that @children was an empty array for files, and the change in 84fde64 "fixed" this by leaving @children for files as nil. The fix is just to add an if dir? to Dirent#each_child - will push that fix later.

Owner

aquasync commented Feb 9, 2013

Should be fixed now.

@aquasync aquasync closed this Feb 9, 2013

scottwillson added a commit to scottwillson/ruby-ole that referenced this issue Jul 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment