Skip to content

Commit

Permalink
prevent index out of bounds when parsing empty state
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Feb 29, 2020
1 parent 1954d98 commit 83d671b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Assets/Plugins/Colyseus/Serializer/Schema/Schema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,14 @@ public void Decode(byte[] bytes, Iterator it = null)
var changes = new List<DataChange>();
var totalBytes = bytes.Length;

// skip TYPE_ID of existing instances
if (bytes[it.Offset] == (byte) SPEC.TYPE_ID)
{
it.Offset += 2;
}

while (it.Offset < totalBytes)
{
// skip TYPE_ID of existing instances
if (bytes[it.Offset] == (byte) SPEC.TYPE_ID)
{
it.Offset += 2;
}

var isNil = decode.NilCheck(bytes, it);
if (isNil) { it.Offset++; }

Expand Down

0 comments on commit 83d671b

Please sign in to comment.