diff --git a/lib/yard/tags/default_factory.rb b/lib/yard/tags/default_factory.rb index 78bfce41e..aee61a949 100644 --- a/lib/yard/tags/default_factory.rb +++ b/lib/yard/tags/default_factory.rb @@ -143,6 +143,7 @@ def extract_types_and_name_from_text_unstripped(text, opening_types = TYPELIST_O seen_space = false i = 0 last_seen = '' + text ||= '' while i < text.length c = text[i, 1] diff --git a/spec/tags/default_factory_spec.rb b/spec/tags/default_factory_spec.rb index 21b0398d2..743841e35 100644 --- a/spec/tags/default_factory_spec.rb +++ b/spec/tags/default_factory_spec.rb @@ -68,6 +68,7 @@ def parse_types(types) end it "returns text unparsed if there is no type list" do + expect(parse_types(nil)).to eq [nil, nil, ''] expect(parse_types('')).to eq [nil, nil, ''] expect(parse_types('[]')).to eq [nil, nil, '[]'] end