Fix crash on version command failure
Why is this change being made?
version_info
returns a string instead of a hash when the trivy --version
command fails. This causes a crash when we subsequently try
to access the scanner_version
and the db_updated_at
, since strings
are integer-indexed.
irb(main):001:0> foo = ''
=> ""
irb(main):002:0> foo[:bar]
Traceback (most recent call last):
5: from /Users/bwilliams/.asdf/installs/ruby/2.7.5/bin/irb:23:in `<main>'
3: from /Users/bwilliams/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
1: from (irb):2:in `[]'
TypeError (no implicit conversion of Symbol into Integer)
Edited by Brian Williams