lib/bcupgrade.rb in bcupgrade-0.1.2 vs lib/bcupgrade.rb in bcupgrade-0.1.3.1
- old
+ new
@@ -7,10 +7,14 @@
end
def self.check_version(cask)
cask_info = Bcupgrade.brew_cask_info(cask)
lines = cask_info.split(/\n/)
- latest_version = lines[0].gsub(/.+: (.+)/, '\1')
+ latest_version = if lines[0].nil?
+ 'error'
+ else
+ lines[0].gsub(/.+: (.+)/, '\1')
+ end
installed_path = "#{Bcupgrade::CASKROOM_PATH}/#{cask}/#{latest_version}"
cask_info.include?(installed_path) ? nil : latest_version
end