File tree Expand file tree Collapse file tree 1 file changed +1
-3
lines changed
Assets/Plugins/Colyseus/Serializer/Schema Expand file tree Collapse file tree 1 file changed +1
-3
lines changed Original file line number Diff line number Diff line change @@ -485,7 +485,7 @@ public void Decode(byte[] bytes, Iterator it = null)
485
485
ISchemaCollection currentValue = valueRef . Clone ( ) ;
486
486
487
487
int newLength = Convert . ToInt32 ( decode . DecodeNumber ( bytes , it ) ) ;
488
- int numChanges = Convert . ToInt32 ( decode . DecodeNumber ( bytes , it ) ) ;
488
+ int numChanges = Math . Min ( Convert . ToInt32 ( decode . DecodeNumber ( bytes , it ) ) , newLength ) ;
489
489
490
490
hasChange = ( numChanges > 0 ) ;
491
491
@@ -494,8 +494,6 @@ public void Decode(byte[] bytes, Iterator it = null)
494
494
// ensure current array has the same length as encoded one
495
495
if ( currentValue . Count > newLength )
496
496
{
497
- numChanges -= currentValue . Count - newLength ;
498
-
499
497
for ( var i = newLength ; i < currentValue . Count ; i ++ )
500
498
{
501
499
var item = currentValue [ i ] ;
You can’t perform that action at this time.
0 commit comments