Minor bug fixes.

This commit is contained in:
CloneTrooper1019 2019-11-04 15:25:22 -06:00
parent 0f4e0d50c6
commit bd1fa5784c
3 changed files with 12 additions and 3 deletions

Binary file not shown.

View File

@ -64,7 +64,7 @@ namespace RobloxFiles
internal double readDouble() => reader.ReadDouble(); internal double readDouble() => reader.ReadDouble();
internal string readString() => reader.ReadString(true); internal string readString() => reader.ReadString(true);
private Attribute[] readArray() internal Attribute[] readArray()
{ {
int count = readInt(); int count = readInt();
var result = new Attribute[count]; var result = new Attribute[count];
@ -75,7 +75,7 @@ namespace RobloxFiles
return result; return result;
} }
private object readEnum() internal object readEnum()
{ {
string name = readString(); string name = readString();
int value = readInt(); int value = readInt();
@ -220,6 +220,12 @@ namespace RobloxFiles
{ {
private void initialize(BinaryReader reader) 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(); int numEntries = reader.ReadInt32();
for (int i = 0; i < numEntries; i++) for (int i = 0; i < numEntries; i++)

View File

@ -49,7 +49,10 @@ namespace RobloxFiles.XmlFormat
{ {
string propType = prop.XmlToken; string propType = prop.XmlToken;
if (prop.XmlToken.Length == 0) if (propType == null)
propType = "";
if (propType.Length == 0)
{ {
propType = GetEnumName(prop.Type); propType = GetEnumName(prop.Type);