From 7cecfd95cc1f81767476f7e39b21d931616c8b09 Mon Sep 17 00:00:00 2001 From: "H. C. Kruse" Date: Sat, 18 May 2024 13:09:13 +0200 Subject: [PATCH] fix: Fix 3.23.1 live parsing --- Loader/ItemBuilder.cs | 4 +++- Loader/ItemClassifier.cs | 2 +- Loader/ItemInstaller.cs | 2 +- Loader/scdb.Xml/Vehicles/AngleRange.cs | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Loader/ItemBuilder.cs b/Loader/ItemBuilder.cs index d48780feb..1c8c66e31 100644 --- a/Loader/ItemBuilder.cs +++ b/Loader/ItemBuilder.cs @@ -92,7 +92,9 @@ List BuildTagList(EntityClassDefinition entity) { var tags = new List(); - var tagString = entity.Components.SAttachableComponentParams?.AttachDef.Tags; + if (entity?.Components?.SAttachableComponentParams?.AttachDef?.Tags == null) return tags; + + var tagString = entity.Components?.SAttachableComponentParams?.AttachDef?.Tags; if (tagString != null) { foreach (var tag in tagString.Split(" ")) diff --git a/Loader/ItemClassifier.cs b/Loader/ItemClassifier.cs index 4db154ecc..7635ec45b 100644 --- a/Loader/ItemClassifier.cs +++ b/Loader/ItemClassifier.cs @@ -99,7 +99,7 @@ public string Classify(EntityClassDefinition entity) { if (!match.Matcher(entity)) continue; - var classification = match.Classifier(entity.Components?.SAttachableComponentParams?.AttachDef.Type, entity.Components?.SAttachableComponentParams.AttachDef.SubType); + var classification = match.Classifier(entity.Components?.SAttachableComponentParams?.AttachDef.Type, entity.Components?.SAttachableComponentParams?.AttachDef?.SubType); if (classification?.EndsWith(".UNDEFINED") ?? false) classification = classification.Substring(0, classification.Length - 10); return classification; diff --git a/Loader/ItemInstaller.cs b/Loader/ItemInstaller.cs index 91922c977..5969e2600 100644 --- a/Loader/ItemInstaller.cs +++ b/Loader/ItemInstaller.cs @@ -28,7 +28,7 @@ public void InstallLoadout(StandardisedItem item, List public void InstallLoadout(EntityClassDefinition item, List loadout) { - if (item?.Components?.SItemPortContainerComponentParams?.Ports == null) + if (item == null || item?.Components?.SItemPortContainerComponentParams?.Ports == null) { return; } diff --git a/Loader/scdb.Xml/Vehicles/AngleRange.cs b/Loader/scdb.Xml/Vehicles/AngleRange.cs index 33843ce0e..fd37b45a7 100644 --- a/Loader/scdb.Xml/Vehicles/AngleRange.cs +++ b/Loader/scdb.Xml/Vehicles/AngleRange.cs @@ -6,9 +6,9 @@ namespace scdb.Xml.Vehicles public class AngleRange { [XmlAttribute] - public int min; + public string min; [XmlAttribute] - public int max; + public string max; } }