Fixed some errors

This commit is contained in:
MaikyM
2020-10-30 23:58:11 -06:00
parent 4bf19551f4
commit 1073daeede
4 changed files with 11 additions and 5 deletions

View File

@@ -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;

View File

@@ -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<UObject>(0), hightRes))
return;

View File

@@ -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, ArraySegment<byte>[]>
{
[package] = new ArraySegment<byte>[] { uasset, uexp, ubulk }
};
#endif
return true;
}

View File

@@ -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);