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

VRT::Map#find_node hits uninformative error when passed bad input #32

Open
adamrdavid opened this issue May 30, 2018 · 0 comments · May be fixed by #29
Open

VRT::Map#find_node hits uninformative error when passed bad input #32

adamrdavid opened this issue May 30, 2018 · 0 comments · May be fixed by #29

Comments

@adamrdavid
Copy link
Contributor

adamrdavid commented May 30, 2018

This error is thrown at: https://github.com/bugcrowd/vrt-ruby/blob/master/lib/vrt/map.rb#L21:

def find_node(string, max_depth: 'variant')
  # return nil unless valid_identifier?(string)
  @_found_nodes[string + max_depth] ||= walk_node_tree(string, max_depth: max_depth)
end

when param: string == nil

     NoMethodError:
       undefined method `+' for nil:NilClass
     # ./lib/vrt/map.rb:22:in `find_node'

when param: !string.is_a? String

     TypeError:
       String can't be coerced into Fixnum
     # ./lib/vrt/map.rb:22:in `+'
     # ./lib/vrt/map.rb:22:in `find_node'

Should be fine to just return nil in these cases since that is what we do when no node can be found.

@adamrdavid adamrdavid linked a pull request May 30, 2018 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant