Skip to content

Commit 6b6ac53

Browse files
author
Stewart Miles
committed
Make package migration resiliant to unversioned packages.
Sometimes UPM returns package info without version information which breaks version parsing logic. This commit gracefully handles missing version information by setting the package version to 0. Change-Id: I6014dd1dac105c79268f5b646e5fd2723992de3d
1 parent 0b4ac6d commit 6b6ac53

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

source/UnityPackageManagerResolver/src/PackageMigrator.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,9 @@ public static HashSet<string> GetVersionHandlerPackageNames(
10521052
/// <returns>Numeric version of the package that can be compared with Version Handler package
10531053
/// versions.</returns>
10541054
public static long CalculateVersion(this UnityPackageManagerClient.PackageInfo packageInfo) {
1055-
return VersionHandlerImpl.FileMetadata.CalculateVersion(packageInfo.Version);
1055+
var version = packageInfo.Version;
1056+
return version != null ?
1057+
VersionHandlerImpl.FileMetadata.CalculateVersion(version) : 0;
10561058
}
10571059
}
10581060

0 commit comments

Comments
 (0)