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

Fix auto indent crash when blank input

This commit is contained in:
aycabta 2019-06-18 21:56:41 +09:00
parent 32e65e9e5a
commit 84903b31c8

View file

@ -70,7 +70,8 @@ class RubyLex
prev_spaces + (indent - prev_indent) * 2
else
code = line_index.zero? ? '' : lines[0..(line_index - 1)].map{ |l| l + "\n" }.join
code += lines[line_index].byteslice(0, byte_pointer)
last_line = lines[line_index]&.byteslice(0, byte_pointer)
code += last_line if last_line
@tokens = Ripper.lex(code)
indent, close_token = process_nesting_level(check_closing: true)
if close_token