CmdPal: try to fix the context menu crash, again. (#40814)

Cherry-pick of 782ee47. That is probably over-aggressive, but it fixes
it.

Closes  #40633
previously: #40744

---------

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
This commit is contained in:
Mike Griese
2025-07-28 08:32:08 -05:00
committed by GitHub
parent 81a7b81927
commit 858081ec78
3 changed files with 24 additions and 2 deletions

View File

@@ -63,9 +63,13 @@ public sealed partial class TopLevelViewModel : ObservableObject, IListItem
{
return item as IContextItem;
}
else if (item is CommandContextItemViewModel commandItem)
{
return commandItem.Model.Unsafe;
}
else
{
return ((CommandContextItemViewModel)item).Model.Unsafe;
return null;
}
}).ToArray();