From 1073daeedee8e436290e1512453415ac95450399 Mon Sep 17 00:00:00 2001 From: MaikyM <51415805+MaikyM@users.noreply.github.com> Date: Fri, 30 Oct 2020 23:58:11 -0600 Subject: [PATCH] Fixed some errors --- FModel/Creator/Icons/DisplayAssetImage.cs | 2 +- FModel/Creator/Icons/LargeSmallImage.cs | 2 +- FModel/Utils/Assets.cs | 3 ++- FModel/Utils/Strings.cs | 9 +++++++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/FModel/Creator/Icons/DisplayAssetImage.cs b/FModel/Creator/Icons/DisplayAssetImage.cs index 862b724a..3185ae74 100644 --- a/FModel/Creator/Icons/DisplayAssetImage.cs +++ b/FModel/Creator/Icons/DisplayAssetImage.cs @@ -42,7 +42,7 @@ namespace FModel.Creator.Icons if (obj.TryGetValue(imageType, out var v1) && v1 is StructProperty s && s.Value is UObject type && type.TryGetValue("ResourceObject", out var v2) && v2 is ObjectProperty resourceObject) { - if (!resourceObject.Value.Resource.OuterIndex.Resource.ObjectName.String.Contains("/Game/Athena/Prototype/Textures/")) + if (resourceObject.Value.Resource.OuterIndex.Resource != null && !resourceObject.Value.Resource.OuterIndex.Resource.ObjectName.String.Contains("/Game/Athena/Prototype/Textures/")) { icon.IconImage = Utils.GetObjectTexture(resourceObject); assetName = "DA_Featured_" + assetName; diff --git a/FModel/Creator/Icons/LargeSmallImage.cs b/FModel/Creator/Icons/LargeSmallImage.cs index e9ae83d8..aff5a550 100644 --- a/FModel/Creator/Icons/LargeSmallImage.cs +++ b/FModel/Creator/Icons/LargeSmallImage.cs @@ -21,7 +21,7 @@ namespace FModel.Creator.Icons path += "_" + assetName.Substring(assetName.LastIndexOf(".") - 1, 1); Package p = Utils.GetPropertyPakPackage(path); - if (p.HasExport() && !p.Equals(default)) + if (p != null && p.HasExport() && !p.Equals(default)) { if (GetPreviewImage(icon, p.GetIndexedExport(0), hightRes)) return; diff --git a/FModel/Utils/Assets.cs b/FModel/Utils/Assets.cs index 7de15eee..6a15dc6d 100644 --- a/FModel/Utils/Assets.cs +++ b/FModel/Utils/Assets.cs @@ -343,11 +343,12 @@ namespace FModel.Utils package = new PakPackage(uasset, uexp, ubulk); else package = new IoPackage(uasset, ubulk, ioStoreEntry); - +#if !DEBUG _CachedFiles[entry] = new Dictionary[]> { [package] = new ArraySegment[] { uasset, uexp, ubulk } }; +#endif return true; } diff --git a/FModel/Utils/Strings.cs b/FModel/Utils/Strings.cs index 7bd6de43..cacf4fde 100644 --- a/FModel/Utils/Strings.cs +++ b/FModel/Utils/Strings.cs @@ -28,8 +28,13 @@ namespace FModel.Utils string trigger; { - string tempPath = path[1..]; - trigger = tempPath.Substring(0, tempPath.IndexOf('/')); + if (path.Contains("/")) + { + string tempPath = path[1..]; + trigger = tempPath.Substring(0, tempPath.IndexOf('/')); + } + else + trigger = path; } Regex regex = new Regex(trigger);