From 6db1b0abd869c091a889c5342203599a3291d3eb Mon Sep 17 00:00:00 2001 From: Danny Weinberg Date: Sun, 3 Feb 2019 10:52:09 -0800 Subject: [PATCH] Handle regex not finding anything --- Library/Homebrew/utils/curl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index bcc47d4394..d66fec1dcb 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -60,7 +60,7 @@ def curl_download(*args, to: nil, **options) supports_partial_download = http_status.to_i == 206 # Partial Content if supports_partial_download && destination.exist? && - destination.size == %r{^.*Content-Range: bytes \d+-\d+/(\d+)\r\n.*$}m.match(headers)[1].to_i + destination.size == %r{^.*Content-Range: bytes \d+-\d+/(\d+)\r\n.*$}m.match(headers)&.[](1)&.to_i return # We've already downloaded all the bytes end