From c149f55ea6afc33a20662fa27a0e7909c6c0bb7f Mon Sep 17 00:00:00 2001 From: Philipp Kolmann Date: Fri, 13 May 2016 14:16:52 +0200 Subject: [PATCH 1/2] fix undefined method `[]' for nil:NilClass issue #27 --- lib/haproxyctl/environment.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/haproxyctl/environment.rb b/lib/haproxyctl/environment.rb index aee53fd..e5a5f77 100644 --- a/lib/haproxyctl/environment.rb +++ b/lib/haproxyctl/environment.rb @@ -39,7 +39,11 @@ def exec def nbproc @nbproc ||= begin config.match /nbproc \s*(\d*)\s*/ - Regexp.last_match[1].to_i || 1 + @x = 1 + if (Regexp.last_match) + Regexp.last_match[1].to_i + end + (@x) end end From 0b66043dd185dc71ff73900749b6db20e98a55c7 Mon Sep 17 00:00:00 2001 From: Philipp Kolmann Date: Fri, 13 May 2016 14:18:58 +0200 Subject: [PATCH 2/2] fix patch --- lib/haproxyctl/environment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/haproxyctl/environment.rb b/lib/haproxyctl/environment.rb index e5a5f77..0898298 100644 --- a/lib/haproxyctl/environment.rb +++ b/lib/haproxyctl/environment.rb @@ -41,7 +41,7 @@ def nbproc config.match /nbproc \s*(\d*)\s*/ @x = 1 if (Regexp.last_match) - Regexp.last_match[1].to_i + @x = Regexp.last_match[1].to_i end (@x) end