From 73402373e3559c474a002e6e6c9e8a2080291bc5 Mon Sep 17 00:00:00 2001 From: dexy Date: Fri, 28 Jan 2022 04:50:10 +1100 Subject: [PATCH] Fix for crash caused by bad entity LOD linkage --- CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs b/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs index 8265371..a1f7cd9 100644 --- a/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs +++ b/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs @@ -315,7 +315,7 @@ namespace CodeWalker.GameFiles YmapEntityDef d = alldefs[i]; int pind = d._CEntityDef.parentIndex; bool isroot = false; - if ((pind < 0) || d.LodInParentYmap) + if ((pind < 0) || (pind >= alldefs.Count) || d.LodInParentYmap) { isroot = true; } @@ -912,7 +912,7 @@ namespace CodeWalker.GameFiles } //pind = 0; } - if ((pind >= 0) && (pind < AllEntities.Length) && rcent.LodInParentYmap) + if ((pind >= 0) && (pind < AllEntities.Length) && !rcent.LodInParentYmap) { var pentity = AllEntities[pind]; pentity.AddChild(rcent);