Skip to content

Commit

Permalink
fix: workaround when server encodes ADD + DELETE in the same MapSchem…
Browse files Browse the repository at this point in the history
…a key.
  • Loading branch information
endel committed Feb 27, 2021
1 parent 4e3fff5 commit ba045bc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Assets/Plugins/Colyseus/Serializer/Schema/Types/MapSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ public object GetByIndex(int index)
public void DeleteByIndex(int index)
{
string dynamicIndex = (string) GetIndex(index);
if (Items.Contains(dynamicIndex))
if (
//
// FIXME:
// The schema encoder should not encode a DELETE operation when using ADD + DELETE in the same key. (in the same patch)
//
dynamicIndex != null &&
Items.Contains(dynamicIndex)
)
{
Items.Remove(dynamicIndex);
Indexes.Remove(index);
Expand Down

0 comments on commit ba045bc

Please sign in to comment.