File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -50,22 +50,28 @@ public static async Task<ShellNewEntry> GetNewContextMenuEntryForType(string ext
50
50
51
51
private static async Task < ShellNewEntry > GetShellNewRegistryEntries ( RegistryKey current , RegistryKey root )
52
52
{
53
- foreach ( var keyName in current . GetSubKeyNames ( ) )
53
+ try
54
54
{
55
- using var key = current . OpenSubKeySafe ( keyName ) ;
56
-
57
- if ( key is null )
58
- continue ;
59
-
60
- if ( keyName == "ShellNew" )
61
- return await ParseShellNewRegistryEntry ( key , root ) ;
62
- else
55
+ foreach ( var keyName in current . GetSubKeyNames ( ) )
63
56
{
64
- var ret = await GetShellNewRegistryEntries ( key , root ) ;
65
- if ( ret is not null )
66
- return ret ;
57
+ using var key = current . OpenSubKeySafe ( keyName ) ;
58
+
59
+ if ( key is null )
60
+ continue ;
61
+
62
+ if ( keyName == "ShellNew" )
63
+ return await ParseShellNewRegistryEntry ( key , root ) ;
64
+ else
65
+ {
66
+ var ret = await GetShellNewRegistryEntries ( key , root ) ;
67
+ if ( ret is not null )
68
+ return ret ;
69
+ }
67
70
}
68
71
}
72
+ catch {
73
+ // Ignore exceptions when the registry is inaccessible to avoid freezes
74
+ }
69
75
70
76
return null ;
71
77
}
You can’t perform that action at this time.
0 commit comments