Skip to content

Commit

Permalink
fix: null pointer exception on package manager window opend
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Jun 18, 2022
1 parent 026bd96 commit b46e7ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Editor/Coffee.UpmGitExtension/UI/PackageDetailsExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void OnPackageSelectionChange(PackageInfo packageInfo)
if (packageVersion != null)
{
var package = GitPackageDatabase.GetPackage(packageVersion);
_targetVersion = package.versions.installed?.uniqueId == packageInfo.packageId ? package.versions.recommended : packageVersion;
_targetVersion = package?.versions?.installed?.uniqueId == packageInfo.packageId ? package.versions.recommended : packageVersion;
if (_targetVersion != null)
{
_updateButton.text = _updateButton.text.Replace(_targetVersion.version.ToString(), _targetVersion.versionString);
Expand All @@ -122,7 +122,7 @@ public void OnPackageSelectionChange(PackageInfo packageInfo)
else
{
var package = GitPackageDatabase.GetPackage(packageInfo.name);
_targetVersion = package.versions.installed != null ? package.versions.recommended : package.versions.primary;
_targetVersion = package?.versions?.installed != null ? package?.versions?.recommended : package?.versions?.primary;
}

#if UNITY_2022_2_OR_NEWER
Expand Down

0 comments on commit b46e7ef

Please sign in to comment.