Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to_tree bug #13

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

to_tree bug #13

sunilkr opened this issue Feb 5, 2013 · 2 comments

Comments

@sunilkr
Copy link

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>'
@aquasync
Copy link
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.

@aquasync
Copy link
Owner

aquasync commented Feb 9, 2013

Should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants