From 9d57bf82f4ed60b07108ff8300eb9d51ce05474a Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Fri, 19 Jun 2015 22:40:46 -0400 Subject: [PATCH] Fix undefined method '[]' for nil:NilClass --- lib/appium_thor/helpers.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/appium_thor/helpers.rb b/lib/appium_thor/helpers.rb index e15178f..461a535 100644 --- a/lib/appium_thor/helpers.rb +++ b/lib/appium_thor/helpers.rb @@ -85,8 +85,11 @@ def _bump value # Note that the first tag won't contain notes. def update_release_notes tag_sort = ->(tag1, tag2) do - tag1_numbers = tag1.match(/\.?v(\d+\.\d+\.\d+)$/)[1].split('.').map! { |n| n.to_i } - tag2_numbers = tag2.match(/\.?v(\d+\.\d+\.\d+)$/)[1].split('.').map! { |n| n.to_i } + tag1_numbers = tag1.match(/\.?v(\d+\.\d+\.\d+)$/) + # avoid indexing into a nil match. nil[1] + tag1_numbers = tag1_numbers[1].split('.').map! { |n| n.to_i } if tag1_numbers + tag2_numbers = tag2.match(/\.?v(\d+\.\d+\.\d+)$/) + tag2_numbers = tag2_numbers[1].split('.').map! { |n| n.to_i } if tag2_numbers tag1_numbers <=> tag2_numbers end @@ -199,4 +202,4 @@ def remove_non_ascii_from_cwd end end # module Helpers end # module Thor -end # module Appium \ No newline at end of file +end # module Appium