From 9db12087c8d4777179e5e98015ab5c15eaf7ec42 Mon Sep 17 00:00:00 2001 From: Bogdan Zavu Date: Wed, 30 Aug 2023 17:11:09 -0400 Subject: [PATCH] fix cast crash --- src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs b/src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs index 7229a634ea7..ea9c7aad510 100644 --- a/src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs @@ -909,7 +909,9 @@ public override void GenerateViewGeometryFromRenderPackagesAndRequestUpdate(Rend renderTimer.Start(); #endif var packages = taskPackages.Packages; - var meshPackages = packages.Cast().Where(rp => rp.MeshVertexCount % 3 == 0); + + var meshPackages = packages.Where(renderPackage => (renderPackage as HelixRenderPackage)?.MeshVertexCount % 3 == 0) + .Select(renderPackage => renderPackage as HelixRenderPackage); RemoveGeometryForUpdatedPackages(meshPackages); try