Allow null texture DAT to ObjConverter

This commit is contained in:
Yukai Li 2021-03-17 08:46:29 -06:00
parent aa1277a4e1
commit b019eabcdc

View file

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