prevent nil.include?

This commit is contained in:
Alex Pop 2016-05-13 19:03:33 +01:00
parent 4152101679
commit 6a9f015527

View file

@ -49,7 +49,7 @@ module Inspec
if @qualifier.length > 1 if @qualifier.length > 1
last = @qualifier[-1] last = @qualifier[-1]
# preventing its('to_i') as the value returned is always 0 # preventing its('to_i') as the value returned is always 0
if last.length == 1 && last[0] !~ /^to_.$/ && !last[0].include?('[') if last.length == 1 && last[0] !~ /^to_.$/ && !last[0].nil? && !last[0].include?('[')
xres = last[0] xres = last[0]
else else
res += '.' + ruby_qualifier(last) res += '.' + ruby_qualifier(last)