File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
src/Files.App/Utils/Shell Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -220,14 +220,6 @@ private void EnumMenuItems(HMENU hMenu, List<Win32ContextMenuItem> menuItemsResu
220
220
{
221
221
Debug . WriteLine ( "Item {0} ({1}): {2}" , index , menuItemInfo . wID , menuItemInfo . dwTypeData ) ;
222
222
223
- // A workaround to avoid an AccessViolationException on some items,
224
- // notably the "Run with graphic processor" menu item of NVIDIA cards
225
- if ( menuItemInfo . wID - 1 > 5000 )
226
- {
227
- container . Dispose ( ) ;
228
- continue ;
229
- }
230
-
231
223
menuItem . Label = menuItemInfo . dwTypeData ;
232
224
menuItem . CommandString = GetCommandString ( _cMenu , menuItemInfo . wID - 1 ) ;
233
225
@@ -314,6 +306,13 @@ public Task<bool> LoadSubMenu(List<Win32ContextMenuItem> subItems)
314
306
315
307
private static string ? GetCommandString ( Shell32 . IContextMenu cMenu , uint offset , Shell32 . GCS flags = Shell32 . GCS . GCS_VERBW )
316
308
{
309
+ // A workaround to avoid an AccessViolationException on some items,
310
+ // notably the "Run with graphic processor" menu item of NVIDIA cards
311
+ if ( offset > 5000 )
312
+ {
313
+ return null ;
314
+ }
315
+
317
316
SafeCoTaskMemString ? commandString = null ;
318
317
319
318
try
@@ -331,7 +330,6 @@ public Task<bool> LoadSubMenu(List<Win32ContextMenuItem> subItems)
331
330
332
331
return null ;
333
332
}
334
-
335
333
catch ( Exception ex ) when ( ex is COMException or NotImplementedException )
336
334
{
337
335
// Not every item has an associated verb
You can’t perform that action at this time.
0 commit comments