Skip to content

Commit

Permalink
Fix GetFullPath crash in SteamFactory.FindJunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Klocman committed May 15, 2023
1 parent 223bbd5 commit be01b5d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions source/UninstallTools/Factory/SteamFactory.cs
Expand Up @@ -102,15 +102,15 @@ private static bool GetSteamInfo(out string steamLocation)
public void Setup(ICollection<ApplicationUninstallerEntry> allUninstallers) { }
public IEnumerable<IJunkResult> FindJunk(ApplicationUninstallerEntry target)
{
if (target.UninstallerKind != UninstallerType.Steam)
if (target.UninstallerKind != UninstallerType.Steam || string.IsNullOrEmpty(target.InstallLocation))
return Enumerable.Empty<IJunkResult>();

var results = new List<IJunkResult>();
try
{
// Look for this appID in steam library's temporary folders (game is inside "common" folder, temp folders are next to that)
var d = new DirectoryInfo(target.InstallLocation);
if (d.Parent?.Name == "common" && d.Parent.Parent != null)
if (d.Exists && d.Parent?.Name == "common" && d.Parent.Parent != null)
{
var libraryDir = d.Parent.Parent.FullName;
Debug.Assert(target.RatingId.StartsWith("Steam App "));
Expand All @@ -133,11 +133,7 @@ public IEnumerable<IJunkResult> FindJunk(ApplicationUninstallerEntry target)
}

}
catch (SecurityException e)
{
Console.WriteLine(e);
}
catch (IOException e)
catch (SystemException e)
{
Console.WriteLine(e);
}
Expand Down

0 comments on commit be01b5d

Please sign in to comment.