Merge pull request #11195 from briancain/fixup/ensure-gem-version-gets-non-nil

Fixup: Ensure Gem::Version.new does not receive nil value
This commit is contained in:
Brian Cain 2019-11-14 15:26:55 -08:00 committed by GitHub
commit ed9769586b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -73,7 +73,15 @@ module VagrantPlugins
end
current = Gem::Version.new(box.version)
latest = Gem::Version.new(md.versions(provider: box.provider).last)
box_versions = md.versions(provider: box.provider)
if box_versions.empty?
latest_box_version = box_versions.last.to_i
else
latest_box_version = box_versions.last
end
latest = Gem::Version.new(latest_box_version)
if latest <= current
@env.ui.success(I18n.t(
"vagrant.box_up_to_date",