From bb26f94cb3b79dd3b5793ccf41c6b4fb1f00d412 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Mon, 10 Aug 2020 17:51:53 +0200 Subject: [PATCH] Avoid element access on nil value Fixes #187 --- lib/modulesync.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/modulesync.rb b/lib/modulesync.rb index ec050557..d742a121 100644 --- a/lib/modulesync.rb +++ b/lib/modulesync.rb @@ -184,9 +184,14 @@ def self.update(options) exit 1 if errors && options[:fail_on_warnings] end - def self.pr(module_options = {}) - github_conf = module_options[:github] - gitlab_conf = module_options[:gitlab] + def self.pr(module_options) + if !module_options.nil? + github_conf = module_options[:github] + gitlab_conf = module_options[:gitlab] + else + github_conf = nil + gitlab_conf = nil + end if !github_conf.nil? base_url = github_conf[:base_url] || ENV.fetch('GITHUB_BASE_URL', 'https://api.github.com')