Skip to content

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

Open
@adamrdavid

Description

@adamrdavid

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions