Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added nil check to avoid exception when production track is not present #22039

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stivlo
Copy link

@stivlo stivlo commented May 19, 2024

With the original code if production track is not present, we get the following exception:

/fastlane-2.220.0/supply/lib/supply/client.rb:303:in block in latest_version': undefined method name' for nil (NoMethodError)

  latest_version = tracks.select { |t| t.track == Supply::Tracks::DEFAULT }.map(&:releases).flatten.reject { |r| r.name.nil? }.max_by(&:name)
                                                                                                                  ^^^^^

with the modified code we get the correct error message:

[!] Unable to find latest version information from "production" track. Please specify track information by using the '--track' option.

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

Description

Testing Steps

With the original code if production track is not present, we get the following exception:

/fastlane-2.220.0/supply/lib/supply/client.rb:303:in `block in latest_version': undefined method `name' for nil (NoMethodError)

      latest_version = tracks.select { |t| t.track == Supply::Tracks::DEFAULT }.map(&:releases).flatten.reject { |r| r.name.nil? }.max_by(&:name)
                                                                                                                      ^^^^^
 
with the modified code we get the correct error message:

[!] Unable to find latest version information from "production" track. Please specify track information by using the '--track' option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool: supply upload_to_playstore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant