From b019eabcdc7c65ab1908c931ccc6723f6ea8900a Mon Sep 17 00:00:00 2001 From: Yukai Li Date: Wed, 17 Mar 2021 08:46:29 -0600 Subject: [PATCH] Allow null texture DAT to ObjConverter --- LibDgf.Graphics/Mesh/ObjConverter.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LibDgf.Graphics/Mesh/ObjConverter.cs b/LibDgf.Graphics/Mesh/ObjConverter.cs index 92e7b79..c9e31c8 100644 --- a/LibDgf.Graphics/Mesh/ObjConverter.cs +++ b/LibDgf.Graphics/Mesh/ObjConverter.cs @@ -22,7 +22,7 @@ namespace LibDgf.Graphics.Mesh public ObjConverter(DatReader textureDat) { - this.textureDat = textureDat ?? throw new ArgumentNullException(nameof(textureDat)); + this.textureDat = textureDat; } public void ConvertObj(Pdb pdb, StreamWriter sw) @@ -269,6 +269,7 @@ namespace LibDgf.Graphics.Mesh public void ExportTextures(StreamWriter mtlWriter, string outputPath) { if (disposedValue) throw new ObjectDisposedException(GetType().FullName); + if (textureDat == null) throw new InvalidOperationException("No texture pack supplied."); int i = 0; numWrittenTextures = 0; @@ -378,7 +379,7 @@ namespace LibDgf.Graphics.Mesh { if (disposing) { - textureDat.Dispose(); + if (textureDat != null) textureDat.Dispose(); } disposedValue = true;