From 435fb34233031efa6ad347491506f23b2adbc428 Mon Sep 17 00:00:00 2001 From: g0tmi1k Date: Wed, 9 May 2018 13:15:12 +0100 Subject: [PATCH] Check for user-agents.txt before using it --- lib/common/common_helper.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/common/common_helper.rb b/lib/common/common_helper.rb index e57d0884..05c6a96d 100644 --- a/lib/common/common_helper.rb +++ b/lib/common/common_helper.rb @@ -255,6 +255,11 @@ end # @return [ String ] A random user-agent from data/user-agents.txt def get_random_user_agent user_agents = [] + + unless File.exist?(USER_AGENTS_FILE) + raise('[ERROR] Missing user-agent data. Please re-run with --update.') + end + f = File.open(USER_AGENTS_FILE, 'r') f.each_line do |line| # ignore comments