diff --git a/DSAnimStudio/FlverSubmeshRenderer.cs b/DSAnimStudio/FlverSubmeshRenderer.cs
index 69b017d..bbd3b17 100644
--- a/DSAnimStudio/FlverSubmeshRenderer.cs
+++ b/DSAnimStudio/FlverSubmeshRenderer.cs
@@ -365,14 +365,20 @@ public FlverSubmeshRenderer(NewMesh parent, FLVER2 flvr, FLVER2.Mesh mesh,
if (GameDataManager.GameType == SoulsAssetPipeline.SoulsGames.SDT)
{
var mtdTex = GameDataManager.LookupMTDTexture(flvr.Materials[mesh.MaterialIndex].MTD, matParam.Type);
- shortTexPath = Utils.GetShortIngameFileName(mtdTex.Path).ToLower();
-
+
texScaleVal /= mtdTex.UVScale;
- if (string.IsNullOrWhiteSpace(shortTexPath))
+ // This can be null so store it first to check before accessing it
+ string mtdTexShortFilename = Utils.GetShortIngameFileName(mtdTex.Path);
+ if (string.IsNullOrWhiteSpace(mtdTexShortFilename))
{
shortTexPath = Utils.GetShortIngameFileName(matParam.Path).ToLower();
}
+ else
+ {
+ // We only want to use this if mtdTexShortFilename is valid, if not we will crash
+ shortTexPath = mtdTexShortFilename.ToLower();
+ }
}
if (GameDataManager.GameType == SoulsAssetPipeline.SoulsGames.DS2SOTFS && paramNameCheck.Contains("FLOWMAP"))
diff --git a/DSAnimStudio/Res/TAE.Template.SDT.xml b/DSAnimStudio/Res/TAE.Template.SDT.xml
index 1a3e75c..0e7390f 100644
--- a/DSAnimStudio/Res/TAE.Template.SDT.xml
+++ b/DSAnimStudio/Res/TAE.Template.SDT.xml
@@ -329,6 +329,7 @@
+
diff --git a/DSAnimStudio/packages.config b/DSAnimStudio/packages.config
index aa99d5f..b1fde04 100644
--- a/DSAnimStudio/packages.config
+++ b/DSAnimStudio/packages.config
@@ -23,7 +23,7 @@
-
+