Skip to content

Commit

Permalink
Fix incorrect logic
Browse files Browse the repository at this point in the history
  • Loading branch information
triphora committed Mar 14, 2023
1 parent 8ad8d01 commit b9ff03a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import masecla.modrinth4j.model.version.ProjectVersion.ProjectDependencyType;
import org.gradle.api.GradleException;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;

import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -94,9 +95,11 @@ public static Dependency fromNew(ProjectDependency newDep) {
* @param versionId ID or version number of the project to resolve
* @return ID of the resolved project
*/
private String resolveVersionId(String projectId, String versionId, ModrinthAPI api) {
private String resolveVersionId(@Nullable String projectId, String versionId, ModrinthAPI api) {
try {
ProjectVersion version = api.versions().getVersionByNumber(projectId, versionId).join();
ProjectVersion version = projectId == null
? api.versions().getVersion(versionId).join()
: api.versions().getVersionByNumber(projectId, versionId).join();
return version.getId();
} catch (Exception e) {
throw new GradleException("Failed to resolve version \"" + versionId + "\"!", e);
Expand Down

0 comments on commit b9ff03a

Please sign in to comment.