Skip to content

Commit

Permalink
Fix undefined method '[]' for nil:NilClass
Browse files Browse the repository at this point in the history
  • Loading branch information
bootstraponline committed Jun 20, 2015
1 parent dd63db2 commit 9d57bf8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/appium_thor/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -199,4 +202,4 @@ def remove_non_ascii_from_cwd
end
end # module Helpers
end # module Thor
end # module Appium
end # module Appium

0 comments on commit 9d57bf8

Please sign in to comment.