diff --git a/RobloxFileFormat.dll b/RobloxFileFormat.dll index 8a5151d..bab453c 100644 Binary files a/RobloxFileFormat.dll and b/RobloxFileFormat.dll differ diff --git a/Tree/Attributes.cs b/Tree/Attributes.cs index 2ffafa9..12811e9 100644 --- a/Tree/Attributes.cs +++ b/Tree/Attributes.cs @@ -64,7 +64,7 @@ namespace RobloxFiles internal double readDouble() => reader.ReadDouble(); internal string readString() => reader.ReadString(true); - private Attribute[] readArray() + internal Attribute[] readArray() { int count = readInt(); var result = new Attribute[count]; @@ -75,7 +75,7 @@ namespace RobloxFiles return result; } - private object readEnum() + internal object readEnum() { string name = readString(); int value = readInt(); @@ -220,6 +220,12 @@ namespace RobloxFiles { private void initialize(BinaryReader reader) { + Stream stream = reader.BaseStream; + + if (stream.Length - stream.Position < 4) + // Not enough room to read the entry count, possibly empty? + return; + int numEntries = reader.ReadInt32(); for (int i = 0; i < numEntries; i++) diff --git a/XmlFormat/IO/XmlFileWriter.cs b/XmlFormat/IO/XmlFileWriter.cs index e5e2ebe..504a5d6 100644 --- a/XmlFormat/IO/XmlFileWriter.cs +++ b/XmlFormat/IO/XmlFileWriter.cs @@ -49,7 +49,10 @@ namespace RobloxFiles.XmlFormat { string propType = prop.XmlToken; - if (prop.XmlToken.Length == 0) + if (propType == null) + propType = ""; + + if (propType.Length == 0) { propType = GetEnumName(prop.Type);