1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/rexml] Fix crash with nil XPath variables (#13)

Patch by Alyssa Ross. Thanks!!!
2a53c54f58
This commit is contained in:
Alyssa Ross 2019-02-09 20:33:06 +00:00 committed by Hiroshi SHIBATA
parent 982208c650
commit ee8985ef0e
2 changed files with 20 additions and 4 deletions

View file

@ -135,8 +135,7 @@ module REXML
#
# An object of a type other than the four basic types is converted to a
# string in a way that is dependent on that type.
def Functions::string( object=nil )
object = @@context[:node] if object.nil?
def Functions::string( object=@@context[:node] )
if object.respond_to?(:node_type)
case object.node_type
when :attribute
@ -165,8 +164,6 @@ module REXML
object.to_s
end
end
when nil
""
else
object.to_s
end