Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

Commit

Permalink
Fixed bug if the asset has no name
Browse files Browse the repository at this point in the history
  • Loading branch information
Perfare committed Aug 24, 2016
1 parent 6f5bf44 commit 0e72691
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Unity Studio/UnityStudioForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,11 @@ private void BuildAssetStrucutres()
}
case 114: //MonoBehaviour
{
if (asset.Offset + 0x1c + 4 > asset.sourceFile.a_Stream.BaseStream.Length)
break;
asset.sourceFile.a_Stream.Position = asset.Offset + 0x1c;
var len = asset.sourceFile.a_Stream.ReadInt32();
if (len > 0 && len < asset.Size)
if (len > 0 && len < asset.Size - 4 - 0x1c)
{
var bytes = asset.sourceFile.a_Stream.ReadBytes(len);
asset.Text = Encoding.UTF8.GetString(bytes);
Expand All @@ -742,9 +744,11 @@ private void BuildAssetStrucutres()
case 115: //MonoScript
case 213: //Sprite
{
if (asset.Offset + 4 > asset.sourceFile.a_Stream.BaseStream.Length)
break;
asset.sourceFile.a_Stream.Position = asset.Offset;
var len = asset.sourceFile.a_Stream.ReadInt32();
if (len > 0 && len < asset.Size)
if (len > 0 && len < asset.Size - 4)
{
var bytes = asset.sourceFile.a_Stream.ReadBytes(len);
asset.Text = Encoding.UTF8.GetString(bytes);
Expand Down

0 comments on commit 0e72691

Please sign in to comment.