From 1769caa7178e2bea7501fdc2292519615a65720c Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Wed, 3 Dec 2025 18:14:49 +0100 Subject: [PATCH] PckStudio.ModelSupport(SkinModelImporter) - Fix null reference exception in `TryConvertToSkinBoxType` & add another box uv check for all elements(cubes) --- PckStuido.ModelSupport/SkinModelImporter.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PckStuido.ModelSupport/SkinModelImporter.cs b/PckStuido.ModelSupport/SkinModelImporter.cs index 2cc7c2a8..77ee8199 100644 --- a/PckStuido.ModelSupport/SkinModelImporter.cs +++ b/PckStuido.ModelSupport/SkinModelImporter.cs @@ -70,6 +70,13 @@ namespace PckStudio.ModelSupport if (!blockBenchModel.Format.UseBoxUv) { Trace.TraceError($"[{nameof(SkinModelImporter)}:{nameof(ImportBlockBenchModel)}] Failed to import skin '{blockBenchModel.Name}': Skin does not use box uv."); + MessageBox.Show("Skin does not use box uv.", $"Failed to import skin '{blockBenchModel.Name}'", MessageBoxButtons.OK, MessageBoxIcon.Error); + return null; + } + if (!blockBenchModel.Elements.All(e => e.UseBoxUv)) + { + Trace.TraceError($"[{nameof(SkinModelImporter)}:{nameof(ImportBlockBenchModel)}] Failed to import skin '{blockBenchModel.Name}': Some boxes do not use box uv."); + MessageBox.Show("Some boxes do not use box uv.", $"Failed to import skin '{blockBenchModel.Name}'", MessageBoxButtons.OK, MessageBoxIcon.Error); return null; } @@ -443,6 +450,8 @@ namespace PckStudio.ModelSupport private static string TryConvertToSkinBoxType(string name) { + if (name is null) + return string.Empty; if (!SkinBOX.IsValidType(name) && SkinBOX.IsValidType(name.ToUpper())) { return name.ToUpper();