From a3e430d98d10f73ecefde7b96730bcd8fac2bc59 Mon Sep 17 00:00:00 2001 From: Perfare Date: Sat, 14 Jul 2018 18:22:14 +0800 Subject: [PATCH] Fixed #223 --- AssetStudio/AssetStudioForm.cs | 7 ++++++- AssetStudio/StudioClasses/Exporter.cs | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/AssetStudio/AssetStudioForm.cs b/AssetStudio/AssetStudioForm.cs index 0cf3370..32713f1 100644 --- a/AssetStudio/AssetStudioForm.cs +++ b/AssetStudio/AssetStudioForm.cs @@ -841,9 +841,13 @@ namespace AssetStudio var m_Mesh = new Mesh(asset, true); if (m_Mesh.m_VertexCount > 0) { - glControl1.Visible = true; viewMatrixData = Matrix4.CreateRotationY(-(float)Math.PI / 4) * Matrix4.CreateRotationX(-(float)Math.PI / 6); #region Vertices + if (m_Mesh.m_Vertices == null || m_Mesh.m_Vertices.Length == 0) + { + StatusStripUpdate("Mesh can't be previewed."); + return; + } int count = 3; if (m_Mesh.m_Vertices.Length == m_Mesh.m_VertexCount * 4) { @@ -970,6 +974,7 @@ namespace AssetStudio } } #endregion + glControl1.Visible = true; createVAO(); } StatusStripUpdate("Using OpenGL Version: " + GL.GetString(StringName.Version) + "\n" diff --git a/AssetStudio/StudioClasses/Exporter.cs b/AssetStudio/StudioClasses/Exporter.cs index 086a16f..96f2a7c 100644 --- a/AssetStudio/StudioClasses/Exporter.cs +++ b/AssetStudio/StudioClasses/Exporter.cs @@ -178,6 +178,10 @@ namespace AssetStudio var sb = new StringBuilder(); sb.AppendLine("g " + m_Mesh.m_Name); #region Vertices + if (m_Mesh.m_Vertices == null || m_Mesh.m_Vertices.Length == 0) + { + return false; + } int c = 3; if (m_Mesh.m_Vertices.Length == m_Mesh.m_VertexCount * 4) {