Skip to content

Commit 9fe6aa3

Browse files
committed
don't break if object doesn't support to_s (e.g. BasicObject)
1 parent a041cb8 commit 9fe6aa3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/ruby-debug-ide/xml_printer.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,11 @@ def build_compact_value_attr(value, value_str)
401401
end
402402

403403
def safe_to_string(value)
404-
str = value.to_s
404+
begin
405+
str = value.to_s
406+
rescue NoMethodError
407+
str = "(Object doesn't support #to_s)"
408+
end
405409
return str unless str.nil?
406410

407411
string_io = StringIO.new

0 commit comments

Comments
 (0)