diff --git a/CodeWalker.Core/GameFiles/MetaTypes/XmlMeta.cs b/CodeWalker.Core/GameFiles/MetaTypes/XmlMeta.cs index bc3ba05..79eb93e 100644 --- a/CodeWalker.Core/GameFiles/MetaTypes/XmlMeta.cs +++ b/CodeWalker.Core/GameFiles/MetaTypes/XmlMeta.cs @@ -179,9 +179,11 @@ namespace CodeWalker.GameFiles case MetaStructureEntryDataType.IntFlags1: case MetaStructureEntryDataType.IntFlags2: { - var _infos = MetaTypes.GetEnumInfo(entry.ReferenceKey); - - mb.AddEnumInfo(_infos.EnumNameHash); + if (entry.ReferenceKey != 0) + { + var _infos = MetaTypes.GetEnumInfo(entry.ReferenceKey); + mb.AddEnumInfo(_infos.EnumNameHash); + } int val = GetEnumInt(entry.ReferenceKey, cnode.InnerText, entry.DataType); Write(val, data, entry.DataOffset); @@ -190,9 +192,11 @@ namespace CodeWalker.GameFiles case MetaStructureEntryDataType.ShortFlags: { - var _infos = MetaTypes.GetEnumInfo(entry.ReferenceKey); - - mb.AddEnumInfo(_infos.EnumNameHash); + if (entry.ReferenceKey != 0) + { + var _infos = MetaTypes.GetEnumInfo(entry.ReferenceKey); + mb.AddEnumInfo(_infos.EnumNameHash); + } int val = GetEnumInt(entry.ReferenceKey, cnode.InnerText, entry.DataType); Write((short)val, data, entry.DataOffset); diff --git a/Forms/MetaForm.cs b/Forms/MetaForm.cs index 87848f9..3076493 100644 --- a/Forms/MetaForm.cs +++ b/Forms/MetaForm.cs @@ -332,7 +332,9 @@ namespace CodeWalker.Forms byte[] data = null; +#if !DEBUG try +#endif { switch (metaFormat) { @@ -358,11 +360,13 @@ namespace CodeWalker.Forms return false; } } +#if !DEBUG catch (Exception ex) { - MessageBox.Show("Exception encountered!\r\n" + ex.Message, "Cannot convert XML"); + MessageBox.Show("Exception encountered!\r\n" + ex.ToString(), "Cannot convert XML"); return false; } +#endif if (data == null) { MessageBox.Show("Schema not supported. (Unspecified error - data was null!)", "Cannot convert XML"); @@ -393,7 +397,7 @@ namespace CodeWalker.Forms } catch (Exception ex) { - MessageBox.Show("Error saving file to RPF! The RPF archive may be corrupted...\r\n" + ex.Message, "Really Bad Error"); + MessageBox.Show("Error saving file to RPF! The RPF archive may be corrupted...\r\n" + ex.ToString(), "Really Bad Error"); } return false;