Skip to content

Commit 11b054b

Browse files
marcofranzen99yaira2
authored andcommitted
avoid async call if not needed
1 parent f032a36 commit 11b054b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Files.App/Helpers/Win32/Win32Helper.Storage.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,13 @@ public static Task StartSTATask(Action action)
166166
public static async Task<string?> GetFileAssociationAsync(string filename, bool checkDesktopFirst = false)
167167
{
168168
if (checkDesktopFirst)
169-
return GetDesktopFileAssociation(filename) ?? (await GetUwpFileAssociations(filename)).FirstOrDefault();
169+
{
170+
var desktopAssociation = GetDesktopFileAssociation(filename);
171+
if (desktopAssociation is not null)
172+
return desktopAssociation;
173+
174+
return (await GetUwpFileAssociations(filename)).FirstOrDefault();
175+
}
170176

171177
return (await GetUwpFileAssociations(filename)).FirstOrDefault() ?? GetDesktopFileAssociation(filename);
172178
}

0 commit comments

Comments
 (0)