summaryrefslogtreecommitdiff
path: root/lib/reline/line_editor.rb
diff options
context:
space:
mode:
authorEamonn Webster <[email protected]>2021-02-14 19:24:03 +0000
committeraycabta <[email protected]>2021-02-21 06:41:11 +0900
commitac9e3b514bc98ded741006c94281fb8aee10c7ef (patch)
tree91d36d99231da9a05d043c9ad81b385d2dab6989 /lib/reline/line_editor.rb
parentdc9e33016c289f54407239b58e3e4669fdd442ad (diff)
[ruby/reline] Avoid tripping over nil prompt
https://github.com/ruby/reline/commit/d4d9d3e3d4
Diffstat (limited to 'lib/reline/line_editor.rb')
-rw-r--r--lib/reline/line_editor.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 557b5aa737..793cad7567 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -124,6 +124,7 @@ class Reline::LineEditor
@prompt_cache_time = Time.now.to_f
end
prompt_list.map!{ prompt } if @vi_arg or @searching_prompt
+ prompt_list = [prompt] if prompt_list.empty?
mode_string = check_mode_string
prompt_list = prompt_list.map{ |pr| mode_string + pr } if mode_string
prompt = prompt_list[@line_index]