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

Fix AddonTask dependency coordinate lookup #213

Merged
merged 1 commit into from
Dec 18, 2022
Merged

Fix AddonTask dependency coordinate lookup #213

merged 1 commit into from
Dec 18, 2022

Conversation

MelnCat
Copy link
Contributor

@MelnCat MelnCat commented Dec 18, 2022

Currently, in


        val artifact = dependency.artifacts.first()
        return if (artifact != null)
            "${dependency.group}:${dependency.name}:${artifact.extension}:${artifact.classifier}:${dependency.version}"
        else "${dependency.group}:${dependency.name}:${dependency.version}"

It checks if there is an artifact in the dependency's artifacts, and returns one of two possible formats. However, the artifact will never be null, since .first() will throw an error if the collection is empty, rather than returning null. This pull request changes the first call into a firstOrNull to have the variable be null if the collection is empty, and make the method work properly.

Currently, in
```

        val artifact = dependency.artifacts.first()
        return if (artifact != null)
            "${dependency.group}:${dependency.name}:${artifact.extension}:${artifact.classifier}:${dependency.version}"
        else "${dependency.group}:${dependency.name}:${dependency.version}"
```
It checks if there is an artifact in the dependency's artifacts, and returns one of two possible formats. However, the `artifact` will never be null, since `.first()` will throw an error if the collection is empty, rather than returning null. This pull request changes the `first` call into a `firstOrNull` to have the variable be null if the collection is empty, and make the method work properly.
@NichtStudioCode NichtStudioCode merged commit 2c59c5a into xenondevs:main Dec 18, 2022
@NichtStudioCode
Copy link
Member

Thanks for contributing 👍

@MelnCat MelnCat deleted the patch-1 branch December 18, 2022 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants