Added nil checks

This commit is contained in:
Felipe 2025-05-30 13:52:25 +00:00 committed by GitHub
parent 61e22cfe25
commit 9452411e32

View File

@ -241,6 +241,7 @@ class WaybackMachineDownloader
# Fetch the initial set of snapshots, sequentially # Fetch the initial set of snapshots, sequentially
@connection_pool.with_connection do |connection| @connection_pool.with_connection do |connection|
initial_list = get_raw_list_from_api(@base_url, nil, connection) initial_list = get_raw_list_from_api(@base_url, nil, connection)
initial_list ||= []
mutex.synchronize do mutex.synchronize do
snapshot_list_to_consider.concat(initial_list) snapshot_list_to_consider.concat(initial_list)
print "." print "."
@ -265,6 +266,7 @@ class WaybackMachineDownloader
@connection_pool.with_connection do |connection| @connection_pool.with_connection do |connection|
result = get_raw_list_from_api("#{@base_url}/*", page, connection) result = get_raw_list_from_api("#{@base_url}/*", page, connection)
end end
result ||= []
[page, result] [page, result]
end end
end end
@ -284,7 +286,7 @@ class WaybackMachineDownloader
# Process results and check for empty pages # Process results and check for empty pages
results.each do |page, result| results.each do |page, result|
if result.empty? if result.nil? || result.empty?
continue_fetching = false continue_fetching = false
break break
else else